svn commit: r287247 - head/lib/libgeom
Xin LI
delphij at FreeBSD.org
Fri Aug 28 06:41:41 UTC 2015
Author: delphij
Date: Fri Aug 28 06:41:40 2015
New Revision: 287247
URL: https://svnweb.freebsd.org/changeset/base/287247
Log:
Plug memory leaks when running out of memory.
Reported by: clang scan-build
MFC after: 2 weeks
Modified:
head/lib/libgeom/geom_xml2tree.c
Modified: head/lib/libgeom/geom_xml2tree.c
==============================================================================
--- head/lib/libgeom/geom_xml2tree.c Fri Aug 28 06:07:30 2015 (r287246)
+++ head/lib/libgeom/geom_xml2tree.c Fri Aug 28 06:41:40 2015 (r287247)
@@ -275,15 +275,17 @@ EndElement(void *userData, const char *n
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;
More information about the svn-src-all
mailing list