commit | f6923e8248fa75a9ec36fe290a930d1e425651af | [log] [tgz] |
---|---|---|
author | Radek Krejci <rkrejci@cesnet.cz> | Thu Jul 02 16:36:53 2020 +0200 |
committer | Radek Krejci <rkrejci@cesnet.cz> | Thu Jul 02 16:36:53 2020 +0200 |
tree | ac423a463f73a2dd21b77d174143e61007a56fc7 | |
parent | b124784ace2ceaf0808ac3b2fb901c2d266cffac [diff] [blame] |
libyang BUGFIX memory leaks reported by coverity
diff --git a/src/printer.c b/src/printer.c index a4905c8..b324030 100644 --- a/src/printer.c +++ b/src/printer.c
@@ -394,6 +394,8 @@ (*out)->method.fpath.f = fopen(filepath, "w"); if (!(*out)->method.fpath.f) { LOGERR(NULL, LY_ESYS, "Failed to open file \"%s\" (%s).", filepath, strerror(errno)); + free(*out); + *out = NULL; return LY_ESYS; } (*out)->method.fpath.filepath = strdup(filepath);