summaryrefslogtreecommitdiffstats
path: root/lib/libgeom
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2015-08-28 06:41:40 +0000
committerdelphij <delphij@FreeBSD.org>2015-08-28 06:41:40 +0000
commitfc4a6235369ed153b2a044411f1510e63726bb21 (patch)
tree059103df37c56811515005cdd6103dca55db1989 /lib/libgeom
parent2d6b12b4999603aa0dff03a24758f30ff6427aa4 (diff)
downloadFreeBSD-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.c4
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;
OpenPOWER on IntegriCloud