aboutsummaryrefslogtreecommitdiff
path: root/lib/libgeom/geom_xml2tree.c
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2015-08-28 06:41:40 +0000
committerXin LI <delphij@FreeBSD.org>2015-08-28 06:41:40 +0000
commitef9fc4afd46c607e3ff8cf63c06f33d845ccb6bd (patch)
tree059103df37c56811515005cdd6103dca55db1989 /lib/libgeom/geom_xml2tree.c
parente5562eb9343bddcc11e791103c3371f0528fe481 (diff)
downloadsrc-ef9fc4afd46c607e3ff8cf63c06f33d845ccb6bd.tar.gz
src-ef9fc4afd46c607e3ff8cf63c06f33d845ccb6bd.zip
Plug memory leaks when running out of memory.
Reported by: clang scan-build MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=287247
Diffstat (limited to 'lib/libgeom/geom_xml2tree.c')
-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 54a31ca42089..2a373d7f31d5 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;