[Prevent] Fixing issues: 10639,10649,14493,23411,25147,27764,28120
authorTomasz Iwanek <t.iwanek@samsung.com>
Tue, 8 Jan 2013 07:18:56 +0000 (08:18 +0100)
committerGerrit Code Review <gerrit2@kim11>
Tue, 8 Jan 2013 10:15:51 +0000 (19:15 +0900)
[Issue#]       LINUXNGWAP-651
[Bug]          Resource leaks, error codes not checked
[Cause]        N/A
[Solution]     ree resources before exit
[Verification] Build repository

Change-Id: I080f0b69e4a43bbe3f26e356fad13fed0631eb29

src/view/common/view_logic_password_support.cpp
src/wrt-launchpad-daemon/feature/preexec.h
src/wrt-launchpad-daemon/launchpad_src/launchpad.c
src/wrt-launchpad-daemon/legacy/preload.h
src/wrt-launchpad-daemon/src/app_sock.c

index 8d079bd..1777fa2 100644 (file)
@@ -231,7 +231,7 @@ DPL::Optional<DPL::String> jsForAutoFillData(const char *uri)
     }
 
     std::string dataStr = data;
-    delete data;
+    delete[] data;
     // replace $VALUE, $KEY to data from database
     std::ostringstream jsOstring;
     jsOstring << dataStr;
index 2cf64d0..d5e9907 100644 (file)
@@ -92,6 +92,7 @@ static inline void __preexec_init(int argc, char **argv)
                if (type_t == NULL) {
                        _E("no available memory\n");
                        __preexec_list_free();
+            fclose(preexec_file);
                        return;
                }
 
@@ -116,6 +117,7 @@ static inline void __preexec_init(int argc, char **argv)
                        _E("no available memory\n");
                        free(type_t);
                        __preexec_list_free();
+            fclose(preexec_file);
                        return;
                }
                type_t->so_path = strdup(sopath);
@@ -124,6 +126,7 @@ static inline void __preexec_init(int argc, char **argv)
                        free(type_t->pkg_type);
                        free(type_t);
                        __preexec_list_free();
+            fclose(preexec_file);
                        return;
                }
                type_t->dl_do_pre_exe = func;
index a8dd993..00631d4 100644 (file)
@@ -316,7 +316,7 @@ _static_ void __add_history(int caller, int callee, const char *pkgname,
                free(kb_data);
                free(hd);
        } else {
-               hd = (struct history_data *)malloc(sizeof(char) * 1033);
+        hd = (struct history_data *)malloc(sizeof(struct history_data));
 
                strncpy(hd->pkg_name, pkgname, MAX_PACKAGE_STR_SIZE-1);
                strncpy(hd->app_path, app_path, MAX_PACKAGE_APP_PATH_SIZE-1);
index c479447..1a3bdba 100644 (file)
@@ -151,7 +151,7 @@ static inline void __preload_init_for_wrt()
 
        while (fgets(soname, MAX_LOCAL_BUFSZ, preload_list) > (char*)0) {
                soname[strlen(soname) - 1] = 0;
-               handle = dlopen(soname, RTLD_NOW|RTLD_GLOBAL);
+        handle = dlopen((const char *)soname, RTLD_NOW|RTLD_GLOBAL);
                if (handle == NULL)
                        continue;
                _D("preload %s# - handle : %x\n", soname, handle);
index cc2328e..95fe640 100644 (file)
@@ -52,7 +52,7 @@ int __create_server_sock(int pid)
 
        /* Create basedir for our sockets */
        orig_mask = umask(0);
-       mkdir(AUL_SOCK_PREFIX, S_IRWXU | S_IRWXG | S_IRWXO | S_ISVTX);
+    (void) mkdir(AUL_SOCK_PREFIX, S_IRWXU | S_IRWXG | S_IRWXO | S_ISVTX);
        umask(orig_mask);
 
        fd = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
@@ -110,6 +110,7 @@ int __create_server_sock(int pid)
 
        if (listen(fd, 10) == -1) {
                _E("listen error");
+        close(fd);
                return -1;
        }
 
@@ -224,7 +225,7 @@ static int __connect_client_sock(int fd, const struct sockaddr *saptr, socklen_t
                return (-1);    /* select error: sockfd not set*/
 
  done:
-       fcntl(fd, F_SETFL, flags);      
+    (void) fcntl(fd, F_SETFL, flags);
        if (error) {
                close(fd);      
                errno = error;