Commit f90ef1cb authored by Pekka Pessi's avatar Pekka Pessi

tport.c: fix calloc error checking in tport_get_local_addrinfo()

MeeGo Coverity issue CID#7508
parent f826cbd7
...@@ -1907,7 +1907,7 @@ tport_get_local_addrinfo(tport_master_t *mr, ...@@ -1907,7 +1907,7 @@ tport_get_local_addrinfo(tport_master_t *mr,
ai = calloc(1, sizeof *ai + li->li_addrlen); ai = calloc(1, sizeof *ai + li->li_addrlen);
if (ai == NULL) if (ai == NULL)
break; goto error;
*prev = ai, prev = &ai->ai_next; *prev = ai, prev = &ai->ai_next;
...@@ -1925,18 +1925,18 @@ tport_get_local_addrinfo(tport_master_t *mr, ...@@ -1925,18 +1925,18 @@ tport_get_local_addrinfo(tport_master_t *mr,
su_freelocalinfo(li_result); su_freelocalinfo(li_result);
if (li) {
tport_freeaddrinfo(*return_ai);
su_seterrno(ENOMEM);
return -1;
}
if (*return_ai == NULL) { if (*return_ai == NULL) {
su_seterrno(ENOENT); su_seterrno(ENOENT);
return -1; return -1;
} }
return 0; return 0;
error:
su_freelocalinfo(li_result);
tport_freeaddrinfo(*return_ai);
su_seterrno(ENOMEM);
return -1;
} }
su_inline su_addrinfo_t *get_next_addrinfo(su_addrinfo_t **all); su_inline su_addrinfo_t *get_next_addrinfo(su_addrinfo_t **all);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment