From: Tim Wiederhake Date: Wed, 12 Jan 2022 12:38:50 +0000 (+0100) Subject: virInterfaceDefParseProtoIPv4: Simplify and cleanup X-Git-Tag: v8.1.0-rc1~465 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f4b970dc2ab2f98fb12b4b4416e85618cdbb096b;p=thirdparty%2Flibvirt.git virInterfaceDefParseProtoIPv4: Simplify and cleanup Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c index 3c29cacdbe..2723eec2ec 100644 --- a/src/conf/interface_conf.c +++ b/src/conf/interface_conf.c @@ -266,10 +266,8 @@ virInterfaceDefParseProtoIPv4(virInterfaceProtocolDef *def, g_autofree xmlNodePtr *ipNodes = NULL; int nipNodes; size_t i; - char *tmp; - tmp = virXPathString("string(./route[1]/@gateway)", ctxt); - def->gateway = tmp; + def->gateway = virXPathString("string(./route[1]/@gateway)", ctxt); dhcp = virXPathNode("./dhcp", ctxt); if (dhcp != NULL) { @@ -287,10 +285,7 @@ virInterfaceDefParseProtoIPv4(virInterfaceProtocolDef *def, def->nips = 0; for (i = 0; i < nipNodes; i++) { - - virInterfaceIPDef *ip; - - ip = g_new0(virInterfaceIPDef, 1); + virInterfaceIPDef *ip = g_new0(virInterfaceIPDef, 1); if (virInterfaceDefParseIP(ip, ipNodes[i]) < 0) { virInterfaceIPDefFree(ip);