[TSAM-5167] Fix some bugs 39/76039/2 accepted/tizen/common/20160623.154543 accepted/tizen/ivi/20160623.125255 accepted/tizen/mobile/20160623.125203 accepted/tizen/tv/20160623.125220 accepted/tizen/wearable/20160623.125241 submit/tizen/20160623.100245
authorSeonah Moon <seonah1.moon@samsung.com>
Wed, 22 Jun 2016 11:43:30 +0000 (20:43 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Wed, 22 Jun 2016 11:47:04 +0000 (20:47 +0900)
- Remove dnsmasq.lease file before enable dhcp server to clear caches
- Fix memory leak

Change-Id: Ia05de19971f4fe37979c722208b264e03c87c249

packaging/mobileap-agent.spec
src/mobileap_main.c
src/mobileap_softap.c

index 518dbd9..59abdd9 100644 (file)
@@ -1,6 +1,6 @@
 Name:          mobileap-agent
 Summary:       Mobile AP daemon for setting tethering environments
-Version:       1.0.59
+Version:       1.0.60
 Release:       1
 Group:         System/Network
 License:       Apache-2.0
index 235cf65..1703010 100755 (executable)
@@ -415,7 +415,7 @@ static void __handle_dnsmasq_dhcp_status_changed_cb(GDBusConnection *connection,
        }
        g_variant_get(parameters, "(sss)",  &ip_addr, &mac, &name);
        if (!g_strcmp0(signal_name, "DhcpConnected") || !g_strcmp0(signal_name, "DhcpLeaseAdded") || !g_strcmp0(signal_name, "DhcpLeaseUpdated")) {
-               SDBG("DhcpConnected signal : %s  %s %s\n", ip_addr, mac, name);
+               SDBG("%s signal: '%s' '%s' '%s'\n", signal_name, ip_addr, mac, name);
                /*
                 * DHCP ACK received, destroy timeout if exists
                 */
@@ -475,8 +475,6 @@ EXIT:
        g_free(ip_addr);
        g_free(mac);
        g_free(name);
-       g_free(info->hostname);
-       g_free(info);
        DBG("-\n");
 }
 
index 730e836..3f6d5b9 100755 (executable)
@@ -1095,6 +1095,9 @@ int _mh_core_execute_dhcp_server(void)
        FILE *fp = NULL;
        pid_t pid;
 
+       if (remove(DNSMASQ_LEASES_FILE) < 0)
+               ERR("Failed to remove %s", DNSMASQ_LEASES_FILE);
+
        if (dnsmasq_pid == 0) {
                fp = fopen(DNSMASQ_CONF_FILE, "w");
                if (NULL == fp) {
@@ -1163,6 +1166,10 @@ int _mh_core_execute_dhcp_server_range(gchar *rangestart, gchar *rangestop)
        char buf[DNSMASQ_RANGE_LEN];
 
        DBG("+\n");
+
+       if (remove(DNSMASQ_LEASES_FILE) < 0)
+               ERR("Failed to remove %s", DNSMASQ_LEASES_FILE);
+
        if (dnsmasq_pid == 0) {
                pid = fork();
                if (pid < 0) {