aboutsummaryrefslogtreecommitdiff
path: root/lib/libgeom
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2010-10-05 15:27:44 +0000
committerEd Maste <emaste@FreeBSD.org>2010-10-05 15:27:44 +0000
commit2cf6dafa3e95460a262162a9252fc6c7578a739b (patch)
tree5ea9a9900facb6ecaafbb8c60d34bb21d0c88850 /lib/libgeom
parent8cd156782f59812ee6c763a4aac5a0887039f90d (diff)
downloadsrc-2cf6dafa3e95460a262162a9252fc6c7578a739b.tar.gz
src-2cf6dafa3e95460a262162a9252fc6c7578a739b.zip
Notes
Diffstat (limited to 'lib/libgeom')
-rw-r--r--lib/libgeom/geom_xml2tree.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/libgeom/geom_xml2tree.c b/lib/libgeom/geom_xml2tree.c
index 821449b66ca8..24315cda8c25 100644
--- a/lib/libgeom/geom_xml2tree.c
+++ b/lib/libgeom/geom_xml2tree.c
@@ -339,21 +339,27 @@ geom_xml2tree(struct gmesh *gmp, char *p)
memset(gmp, 0, sizeof *gmp);
LIST_INIT(&gmp->lg_class);
parser = XML_ParserCreate(NULL);
+ if (parser == NULL)
+ return (ENOMEM);
mt = calloc(1, sizeof *mt);
- if (mt == NULL)
+ if (mt == NULL) {
+ XML_ParserFree(parser);
return (ENOMEM);
+ }
mt->mesh = gmp;
XML_SetUserData(parser, mt);
XML_SetElementHandler(parser, StartElement, EndElement);
XML_SetCharacterDataHandler(parser, CharData);
i = XML_Parse(parser, p, strlen(p), 1);
- if (i != 1)
- return (-1);
XML_ParserFree(parser);
+ if (i != 1) {
+ free(mt);
+ return (-1);
+ }
gmp->lg_ident = calloc(sizeof *gmp->lg_ident, mt->nident + 1);
+ free(mt);
if (gmp->lg_ident == NULL)
return (ENOMEM);
- free(mt);
i = 0;
/* Collect all identifiers */
LIST_FOREACH(cl, &gmp->lg_class, lg_class) {