diff options
| author | Ed Maste <emaste@FreeBSD.org> | 2010-10-19 13:06:26 +0000 |
|---|---|---|
| committer | Ed Maste <emaste@FreeBSD.org> | 2010-10-19 13:06:26 +0000 |
| commit | 15c76c7f076bb5b9b2418145a36a6d7f93a7062d (patch) | |
| tree | fc6a4da09ac510c0efd5ffecba347c46020ca7a1 /lib | |
| parent | 19693cfacc3757178814cdbd0e98272e046f602b (diff) | |
Notes
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/libgeom/geom_xml2tree.c | 14 |
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) { |
