Hi, Please do not send patches as attachments as the formatting gets mangled when I reply to your patch.
On Mon, 2014-08-04 at 11:16 +0000, Saurav Babu wrote: > diff --git a/src/dhcp.c b/src/dhcp.c index 132b787..a3dd3c4 100644 --- > a/src/dhcp.c +++ b/src/dhcp.c @@ -587,6 +587,7 @@ int > __connman_dhcp_start(struct connman_ipconfig *ipconfig, { > const char *last_addr = NULL; struct connman_dhcp *dhcp; > + int err; DBG(""); > @@ -615,9 +616,12 @@ > int __connman_dhcp_start(struct connman_ipconfig *ipconfig, > connman_network_ref(network); > } > - g_hash_table_insert(ipconfig_table, ipconfig, dhcp); > + err = dhcp_initialize(dhcp); > - dhcp_initialize(dhcp); > + if(err != 0) + return err; > + + g_hash_table_insert(ipconfig_table, ipconfig, dhcp); > } > dhcp->callback = callback; First of all, check err for < 0 as 0 and bigger signal some variants of success. There is a memory leak here, the dhcp structure is allocated but not freed on error. Also the network is referenced, but not unreferenced on error. Cheers, Patrik _______________________________________________ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman