fence-virt: Fix null pointer deref
Fix an unlikely null pointer dereference that could occur subsequent to malloc failing. Signed-off-by: Ryan McCabe <rmccabe@redhat.com>
This commit is contained in:
parent
0c502aad77
commit
c48c06819f
@ -82,13 +82,13 @@ add_ip(ip_list_t *ipl, char *ipaddr, char family)
|
||||
return -1;
|
||||
}
|
||||
|
||||
dbg_printf(4, "Adding IP %s to list (family %d)\n", ipaddr, family);
|
||||
|
||||
ipa = malloc(sizeof(*ipa));
|
||||
memset(ipa, 0, sizeof(*ipa));
|
||||
ipa = calloc(1, sizeof(*ipa));
|
||||
if (!ipa)
|
||||
return -1;
|
||||
ipa->ipa_family = family;
|
||||
ipa->ipa_address = strdup(ipaddr);
|
||||
|
||||
dbg_printf(4, "Adding IP %s to list (family %d)\n", ipaddr, family);
|
||||
TAILQ_INSERT_TAIL(ipl, ipa, ipa_entries);
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user