From ce880ad8ba4894d1fee0df50aa37fca4142ae791 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Fri, 28 Jan 2022 18:22:06 +0100 Subject: [PATCH] lib: Don't set variable to NULL after VIR_FREE() There are a few places where a variable is VIR_FREE()-d and then explicitly set to NULL. This is not necessary since VIR_FREE() does that for us. Signed-off-by: Michal Privoznik Reviewed-by: Erik Skultety --- src/conf/domain_conf.c | 1 - src/conf/nwfilter_conf.c | 1 - tests/virtypedparamtest.c | 1 - 3 files changed, 3 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 58e696416d..e931aef6c4 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -12746,7 +12746,6 @@ virDomainGraphicsDefNew(virDomainXMLOption *xmlopt) if (xmlopt && xmlopt->privateData.graphicsNew && !(def->privateData = xmlopt->privateData.graphicsNew())) { VIR_FREE(def); - def = NULL; } return def; diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c index 3fedfdde56..c886218dde 100644 --- a/src/conf/nwfilter_conf.c +++ b/src/conf/nwfilter_conf.c @@ -1813,7 +1813,6 @@ virNWFilterRuleDetailsParse(xmlNodePtr node, if (match && STREQ(match, "no")) match_flag = NWFILTER_ENTRY_ITEM_FLAG_IS_NEG; VIR_FREE(match); - match = NULL; while (att[idx].name != NULL) { prop = virXMLPropString(node, att[idx].name); diff --git a/tests/virtypedparamtest.c b/tests/virtypedparamtest.c index 87b47ba86e..5ced453be5 100644 --- a/tests/virtypedparamtest.c +++ b/tests/virtypedparamtest.c @@ -106,7 +106,6 @@ testTypedParamsFilter(const void *opaque G_GNUC_UNUSED) goto cleanup; } VIR_FREE(filtered); - filtered = NULL; nfiltered = virTypedParamsFilter(params, G_N_ELEMENTS(params), "bar", &filtered);