From: Patrik Flykt Date: Mon, 5 Sep 2011 06:19:19 +0000 (+0200) Subject: dnsproxy: Fix __connman_dnsproxy_add_listener() error handling X-Git-Tag: 0.78~263 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bf76335588bb9266f644648ad482f9d0ec7d5e02;p=platform%2Fupstream%2Fconnman.git dnsproxy: Fix __connman_dnsproxy_add_listener() error handling Do not add dnsproxy listener data to hash table if we fail to create either a udp or tcp listener. --- diff --git a/src/dnsproxy.c b/src/dnsproxy.c index d9e291c..a56e312 100644 --- a/src/dnsproxy.c +++ b/src/dnsproxy.c @@ -1522,11 +1522,16 @@ int __connman_dnsproxy_add_listener(const char *interface) ifdata->udp_listener_watch = 0; ifdata->tcp_listener_channel = NULL; ifdata->tcp_listener_watch = 0; - g_hash_table_insert(listener_table, ifdata->ifname, ifdata); err = create_listener(interface); - if (err < 0) + if (err < 0) { + connman_error("Couldn't create listener for %s err %d", + interface, err); + g_free(ifdata->ifname); + g_free(ifdata); return err; + } + g_hash_table_insert(listener_table, ifdata->ifname, ifdata); return 0; }