[libvirt] [PATCH v1 12/18] use VIR_AUTOFREE in src/util/virdbus.c

Erik Skultety eskultet at redhat.com
Tue Jun 5 13:32:03 UTC 2018


On Sun, Jun 03, 2018 at 01:42:10PM +0530, Sukrit Bhatnagar wrote:
> Modify code to use VIR_AUTOFREE macro wherever required.
>
> Signed-off-by: Sukrit Bhatnagar <skrtbhtngr at gmail.com>
> ---
>  src/util/virdbus.c | 28 +++++++---------------------
>  1 file changed, 7 insertions(+), 21 deletions(-)
>
> diff --git a/src/util/virdbus.c b/src/util/virdbus.c
> index ba8b684..66dbe41 100644
> --- a/src/util/virdbus.c
> +++ b/src/util/virdbus.c
> @@ -614,9 +614,8 @@ virDBusMessageIterEncode(DBusMessageIter *rootiter,
>      size_t nstack = 0;
>      size_t siglen;
>      size_t skiplen;
> -    char *contsig = NULL;
>      const char *vsig;
> -    DBusMessageIter *newiter = NULL;
> +    VIR_AUTOFREE(DBusMessageIter *) newiter = NULL;

Doh!...and here we are facing a potential exception to the rule I mentioned in
one of the previous patches about compound types and VIR_AUTOFREE...Sigh,
although possible, I really don't think we want to introduce *Free helpers for
external types like ^this...that's honestly my only argument to support my
earlier claim about the VIR_AUTOFREE usage with scalar types only.

It's not a "libvirt-native" type, so let's close our eyes and forget that we're
doing this.

Erik




More information about the libvir-list mailing list