Skip to content

Commit

Permalink
coverity: fix : Resource leak (RESOURCE_LEAK)
Browse files Browse the repository at this point in the history
On error, data was not freed.

Signed-off-by: Robin Getz <[email protected]>
  • Loading branch information
rgetz committed Apr 8, 2020
1 parent 135c189 commit 23ab5d8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dns_sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,13 +286,14 @@ int dnssd_discover_host(char *addr_str, size_t addr_len, uint16_t *port)
ret = dnssd_find_hosts(&ddata);

if (ret < 0)
return ret;
goto host_fail;

if (ddata) {
*port = ddata->port;
strncpy(addr_str, ddata->addr_str, addr_len);
}

host_fail:
dnssd_free_all_discovery_data(ddata);

/* negative error codes, 0 for no data */
Expand Down

0 comments on commit 23ab5d8

Please sign in to comment.