virsh: virshAddressParse: check for malformed address

The refactor left in the 'if (addr)' check,
but before 'addr' was the return value of strchr
and now it's the return value of virshAddressParse.

Check 'a' instead since that's the return of strchr now.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: 67bf91e1c3
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Ján Tomko 2020-12-10 09:42:43 +01:00
parent 61802ce3f0
commit 3d016477cc

View File

@ -124,7 +124,7 @@ virshAddressParse(const char *str,
g_autofree char *type = g_strdup(str);
char *a = strchr(type, ':');
if (!addr)
if (!a)
return -1;
*a = '\0';