diff options
author | sjg <sjg@FreeBSD.org> | 2015-05-27 01:19:58 +0000 |
---|---|---|
committer | sjg <sjg@FreeBSD.org> | 2015-05-27 01:19:58 +0000 |
commit | 65145fa4c81da358fcbc3b650156dab705dfa34e (patch) | |
tree | 55c065b6730aaac2afb6c29933ee6ec5fa4c4249 /lib/libgeom | |
parent | 60ff4eb0dff94a04d75d0d52a3957aaaf5f8c693 (diff) | |
parent | e6b664c390af88d4a87208bc042ce503da664c3b (diff) | |
download | FreeBSD-src-65145fa4c81da358fcbc3b650156dab705dfa34e.zip FreeBSD-src-65145fa4c81da358fcbc3b650156dab705dfa34e.tar.gz |
Merge sync of head
Diffstat (limited to 'lib/libgeom')
-rw-r--r-- | lib/libgeom/Makefile | 3 | ||||
-rw-r--r-- | lib/libgeom/geom_xml2tree.c | 16 |
2 files changed, 14 insertions, 5 deletions
diff --git a/lib/libgeom/Makefile b/lib/libgeom/Makefile index b19faf6..20b7a4c 100644 --- a/lib/libgeom/Makefile +++ b/lib/libgeom/Makefile @@ -13,8 +13,7 @@ CFLAGS += -I${.CURDIR} WARNS?= 3 -DPADD= ${LIBBSDXML} ${LIBSBUF} -LDADD= -lbsdxml -lsbuf +LIBADD+= bsdxml sbuf MAN= libgeom.3 diff --git a/lib/libgeom/geom_xml2tree.c b/lib/libgeom/geom_xml2tree.c index 2874cd0..2c23361 100644 --- a/lib/libgeom/geom_xml2tree.c +++ b/lib/libgeom/geom_xml2tree.c @@ -186,6 +186,7 @@ static void EndElement(void *userData, const char *name) { struct mystate *mt; + struct gconf *c; struct gconfig *gc; char *p; @@ -256,10 +257,18 @@ EndElement(void *userData, const char *name) if (!strcmp(name, "config")) { mt->config = NULL; + free(p); return; } - if (mt->config != NULL) { + if (mt->config != NULL || (!strcmp(name, "wither") && + (mt->provider != NULL || mt->geom != NULL))) { + if (mt->config != NULL) + c = mt->config; + else if (mt->provider != NULL) + c = &mt->provider->lg_config; + else + c = &mt->geom->lg_config; gc = calloc(1, sizeof *gc); if (gc == NULL) { mt->error = errno; @@ -270,14 +279,15 @@ EndElement(void *userData, const char *name) } 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); return; } - gc->lg_val = p; - LIST_INSERT_HEAD(mt->config, gc, lg_config); + gc->lg_val = p ? p : strdup("1"); + LIST_INSERT_HEAD(c, gc, lg_config); return; } |