Remove prevent issue : Improper use of negative value
authorJaehyun Kim <jeik01.kim@samsung.com>
Sun, 3 Feb 2013 14:20:32 +0000 (23:20 +0900)
committerGerrit Code Review <gerrit2@kim11>
Sun, 3 Feb 2013 15:29:24 +0000 (00:29 +0900)
  - negative_returns: "g_monitor_sockfd" is passed to a parameter that cannot be negative
  - resource leak : all the sockets created in wfd_ws_activate() should be closed in case of failure

Change-Id: I28f26b714b6aba61c3b84b78361ea11557a818ec

debian/changelog
packaging/wifi-direct-manager.spec
plugin/wpasupplicant/src/wifi-direct-plugin.c

index 5a3a54e..0369eaa 100644 (file)
@@ -1,3 +1,11 @@
+wfi-direct-manager (0.6.7) precise; urgency=low
+
+  * Remove prevent issue : Improper use of negative value
+  * Git : framework/connectivity/wifi-direct-manager
+  * Tag : wifi-direct-manager_0.6.7
+
+ -- Jaehyun Kim <jeik01@samsung.com>  Sun, 03 Feb 2013 23:16:38 +0900
+
 wfi-direct-manager (0.6.6) precise; urgency=low
 
   * Fix resource leaks
index a641912..fa64940 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       wifi-direct-manager
 Summary:    Wi-Fi Direct manger
-Version:    0.6.6
+Version:    0.6.7
 Release:    1
 Group:      TO_BE_FILLED
 License:    Apache License Version 2.0
index a2b2a9c..7aee2bd 100644 (file)
@@ -2118,7 +2118,7 @@ int wfd_ws_activate()
        char cmd[128] = {0, };
        char res_buffer[1024]={0,};
        int res_buffer_len=sizeof(res_buffer);
-       
+
        // Loading Driver,  Excuting p2p_supplicant
        system("/usr/bin/wlan.sh p2p");
        system("/usr/sbin/p2p_supp.sh start");
@@ -2161,18 +2161,29 @@ int wfd_ws_activate()
                                if (__wpa_ctrl_attach(g_monitor_sockfd) < 0)
                                {
                                        WDP_LOGE( "Failed to attach monitor socket! sockfd=[%d]", g_monitor_sockfd);
+                                       system("/usr/sbin/p2p_supp.sh stop");
+                                       system("/usr/bin/wlan.sh stop");
+                                       close(g_global_sockfd);
+                                       close(g_control_sockfd);
+                                       close(g_monitor_sockfd);
                                        return false;
                                }
                                break;
-                       }
+                       } else
+                               close(g_control_sockfd);
                } else {
                        WDP_LOGE( "Failed to attach control socket! sockfd=[%d]", g_control_sockfd);
                }
                count--;
 
-               if (count == 0)
-                       WDP_LOGE( "Failed to create socket !!\n");              
-               
+               if (count == 0) {
+                       WDP_LOGE( "Failed to create socket !!\n");
+                       system("/usr/sbin/p2p_supp.sh stop");
+                       system("/usr/bin/wlan.sh stop");
+                       close(g_global_sockfd);
+                       return false;
+               }
+
        } while (count > 0);
 
        WDP_LOGD( "Successfully socket connected to server !!\n");