diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2016-04-29 10:48:05 +0200 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2016-04-29 10:48:05 +0200 |
commit | c7f21bebbeadf36f71251b6b0c62f2d93b308a5c (patch) | |
tree | 4ee71b5d482861c384bfab714a17858ea218de6a | |
parent | 668d66c4e1f79081d1096c7cf63e807637b88237 (diff) |
iface: Fix memory leak in error case
If add from leaking in case the address was (unexpectedly) not found.
This addresses CID 99695 discovered by the Coverity scanner.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
-rw-r--r-- | iface.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -145,10 +145,13 @@ static void iface_record_addr_del(struct iface_record *rec, struct sockaddr_stor rec->size--; } else { char as[NI_MAXHOST]; + if (getnameinfo((struct sockaddr *)addr, sizeof(*addr), as, sizeof(as), NULL, 0, NI_NUMERICHOST)) strncpy(as, "<unknown>", sizeof(as) - 1); log_err("Address %s to delete not found in records\n", as); + + free(addrs); } } else if (rec->size == 1) { free(rec->addrs); |