From: John Ferlan Date: Thu, 20 Apr 2017 15:51:22 +0000 (-0400) Subject: nwfilter: Move save of config until after successful assign X-Git-Tag: v3.3.0-rc1~62 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3e71a8830b2683ee88fa10cb048eabb99a446c0;p=thirdparty%2Flibvirt.git nwfilter: Move save of config until after successful assign Only save the config when using a generated UUID if we were able to create an object for the def. There could have been "other reasons" for the assignment to fail, so saving the config could be incorrect. Signed-off-by: John Ferlan --- diff --git a/src/conf/virnwfilterobj.c b/src/conf/virnwfilterobj.c index 2a060fb851..c69407ac80 100644 --- a/src/conf/virnwfilterobj.c +++ b/src/conf/virnwfilterobj.c @@ -500,14 +500,14 @@ virNWFilterObjListLoadConfig(virNWFilterObjListPtr nwfilters, goto error; } + if (!(obj = virNWFilterObjListAssignDef(nwfilters, def))) + goto error; + /* We generated a UUID, make it permanent by saving the config to disk */ if (!def->uuid_specified && virNWFilterSaveConfig(configDir, def) < 0) goto error; - if (!(obj = virNWFilterObjListAssignDef(nwfilters, def))) - goto error; - VIR_FREE(configFile); return obj;