summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2015-04-09 10:10:05 +0000
committermav <mav@FreeBSD.org>2015-04-09 10:10:05 +0000
commit5f22f76484ca0d7ab92d0d4190aafcb0d796a0f3 (patch)
tree0d36e36d8e52fbecb3ae89e61c842c29ceb5de3a /lib
parent2b74acfbccc9df3abd609f0c8106be951ea02875 (diff)
downloadFreeBSD-src-5f22f76484ca0d7ab92d0d4190aafcb0d796a0f3.zip
FreeBSD-src-5f22f76484ca0d7ab92d0d4190aafcb0d796a0f3.tar.gz
MFC r280687: Make GEOM_PART work in presence of previous withered self.
Diffstat (limited to 'lib')
-rw-r--r--lib/libgeom/geom_xml2tree.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/libgeom/geom_xml2tree.c b/lib/libgeom/geom_xml2tree.c
index 2874cd0..d5d4f31 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;
@@ -259,7 +260,14 @@ EndElement(void *userData, const char *name)
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 +278,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;
}
OpenPOWER on IntegriCloud