net: close socket after checking available port
authorMunkyu Im <munkyu.im@samsung.com>
Wed, 30 Dec 2015 02:04:11 +0000 (11:04 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Wed, 30 Dec 2015 02:44:27 +0000 (11:44 +0900)
fixed check_port_bind_listen() in 6ae322880b2a6f4de42bd25c9f19ccce870136cd
But one caller of this function was skipped closing socket.
So, this commit adds socket close.

Change-Id: Id204f7e3bd15111019ae86cbacaa75111edd59fd
Signed-off-by: Munkyu Im <munkyu.im@samsung.com>
tizen/src/util/osutil-linux.c

index cbea320..5ea0d65 100644 (file)
@@ -43,6 +43,7 @@
 #include <sys/utsname.h>
 #include <sys/sysinfo.h>
 
+#include "qemu/sockets.h"
 #include "qemu/error-report.h"
 
 #include "osutil.h"
@@ -84,8 +85,10 @@ void check_vm_lock_os(void)
                     shm_info.shm_nattch);
                 if ((shm_info.shm_nattch > 0) &&
                     g_strcmp0(get_drive_image_file(), (char *)shm_addr) == 0) {
-                    if (check_port_bind_listen(port + 1) > 0) {
+                    int ret = 0;
+                    if ((ret = check_port_bind_listen(port + 1)) > 0) {
                         shmdt(shm_addr);
+                        closesocket(ret);
                         continue;
                     }
                     shmdt(shm_addr);