[libvirt] [PATCH] Revert "nwfilter: Move save of config until after successful assign"

Pavel Hrdina phrdina at redhat.com
Mon Jul 17 08:15:47 UTC 2017


On Sat, Jul 15, 2017 at 02:40:06PM -0400, John Ferlan wrote:
> This reverts commit b3e71a8830b2683ee88fa10cb048eabb99a446c0.
> 
> As it turns out this ends up very badly as the @def could be Free'd
> even though it's owned by @obj as a result of the AssignDef.

I don't see a reason to revert it.  What do you mean that the @def can
be freed?  The virNWFilterObjListAssignDef() doesn't free the @def that
is passed to it, it only assign it to nwfilter object and returns it
immediately.

Pavel

> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
>  src/conf/virnwfilterobj.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/conf/virnwfilterobj.c b/src/conf/virnwfilterobj.c
> index b5aaa6b..b36eda1 100644
> --- a/src/conf/virnwfilterobj.c
> +++ b/src/conf/virnwfilterobj.c
> @@ -501,14 +501,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;
>  
> -- 
> 2.9.4
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170717/99aeb6a6/attachment-0001.sig>


More information about the libvir-list mailing list