From: Sukrit Bhatnagar Date: Tue, 24 Jul 2018 15:52:19 +0000 (+0530) Subject: util: hook: use VIR_AUTOPTR for aggregate types X-Git-Tag: v4.6.0-rc1~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=584f0f5ad726f3a75e678fea19770adf7736efb0;p=thirdparty%2Flibvirt.git 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 Reviewed-by: Erik Skultety --- diff --git a/src/util/virhook.c b/src/util/virhook.c index 4673655dee..993f06d819 100644 --- a/src/util/virhook.c +++ b/src/util/virhook.c @@ -232,7 +232,7 @@ virHookCall(int driver, { int ret; VIR_AUTOFREE(char *) path = NULL; - virCommandPtr cmd; + VIR_AUTOPTR(virCommand) cmd = NULL; const char *drvstr; const char *opstr; const char *subopstr; @@ -314,7 +314,5 @@ virHookCall(int driver, virGetLastErrorMessage()); } - virCommandFree(cmd); - return ret; }