util: hook: use VIR_AUTOPTR for aggregate types

By making use of GNU C's cleanup attribute handled by the
VIR_AUTOPTR macro for declaring aggregate pointer variables,
majority of the calls to *Free functions can be dropped, which
in turn leads to getting rid of most of our cleanup sections.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
Sukrit Bhatnagar 2018-07-24 21:22:19 +05:30 committed by Erik Skultety
parent fa0134cd3a
commit 584f0f5ad7

View File

@ -232,7 +232,7 @@ virHookCall(int driver,
{ {
int ret; int ret;
VIR_AUTOFREE(char *) path = NULL; VIR_AUTOFREE(char *) path = NULL;
virCommandPtr cmd; VIR_AUTOPTR(virCommand) cmd = NULL;
const char *drvstr; const char *drvstr;
const char *opstr; const char *opstr;
const char *subopstr; const char *subopstr;
@ -314,7 +314,5 @@ virHookCall(int driver,
virGetLastErrorMessage()); virGetLastErrorMessage());
} }
virCommandFree(cmd);
return ret; return ret;
} }