diff options
author | delphij <delphij@FreeBSD.org> | 2015-08-28 06:41:40 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2015-08-28 06:41:40 +0000 |
commit | fc4a6235369ed153b2a044411f1510e63726bb21 (patch) | |
tree | 059103df37c56811515005cdd6103dca55db1989 /lib/libgeom | |
parent | 2d6b12b4999603aa0dff03a24758f30ff6427aa4 (diff) | |
download | FreeBSD-src-fc4a6235369ed153b2a044411f1510e63726bb21.zip FreeBSD-src-fc4a6235369ed153b2a044411f1510e63726bb21.tar.gz |
Plug memory leaks when running out of memory.
Reported by: clang scan-build
MFC after: 2 weeks
Diffstat (limited to 'lib/libgeom')
-rw-r--r-- | lib/libgeom/geom_xml2tree.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libgeom/geom_xml2tree.c b/lib/libgeom/geom_xml2tree.c index 54a31ca..2a373d7 100644 --- a/lib/libgeom/geom_xml2tree.c +++ b/lib/libgeom/geom_xml2tree.c @@ -275,15 +275,17 @@ EndElement(void *userData, const char *name) XML_StopParser(mt->parser, 0); warn("Cannot allocate memory during processing of '%s' " "element", name); + free(p); return; } gc->lg_name = strdup(name); if (gc->lg_name == NULL) { - free(gc); mt->error = errno; XML_StopParser(mt->parser, 0); warn("Cannot allocate memory during processing of '%s' " "element", name); + free(gc); + free(p); return; } gc->lg_val = p; |