qemu: remove prevent issue 64/14164/1
authormunkyu.im <munkyu.im@samsung.com>
Thu, 26 Dec 2013 07:31:36 +0000 (16:31 +0900)
committermunkyu.im <munkyu.im@samsung.com>
Thu, 26 Dec 2013 07:31:36 +0000 (16:31 +0900)
added to check null pointer.
added to check lock/unlock.

Change-Id: I98e3fd8a297bb7a7df1149657606cf3d74522f2f
Signed-off-by: munkyu.im <munkyu.im@samsung.com>
tizen/src/debug_ch.c
tizen/src/ecs/ecs.c
tizen/src/ecs/ecs_msg.c
tizen/src/hw/maru_virtio_nfc.c
tizen/src/osutil.c

index af99ce982580f9c6b14b9d1a03312ee3cf2c623c..32fb5f2265ede668e1587aff086aa893973d8290 100644 (file)
@@ -310,7 +310,11 @@ static void debug_init(void)
             return;
         }
 
-        fseek(fp, 0, SEEK_SET);
+        if(fseek(fp, 0, SEEK_SET) != 0) {
+            fclose(fp);
+            fprintf(stderr, "failed to fseek()\n");
+            return;
+        }
         const char* str = fgets(tmp, 1024, fp);
         if (str) {
             tmp[strlen(tmp) - 1] = 0;
index 7bbd271be8e51f2057b26ccd8e960a0d52607224..37f409b81277285eefaad8d89a5b3023c46c5637 100644 (file)
@@ -955,6 +955,7 @@ bool handle_protobuf_msg(ECS_Client* cli, char* data, int len)
             }
             else {
                 LOG("unsupported category is found: %s", msg->category);
+                pthread_mutex_unlock(&mutex_clilist);
                 goto fail;
             }
         }
index 8bd31b337666f4e4ec87aff177a31c6a401dbeac..4369b824e7f846919990b1d63fb94220f80cc295 100644 (file)
@@ -431,10 +431,11 @@ bool msgproc_nfc_req(ECS_Client* ccli, ECS__NfcReq* msg)
 
     if (data != NULL) {
         send_to_nfc(ccli->client_id, ccli->client_type, data, msg->data.len);
+        g_free(data);
         return true;
+    } else {
+        return false;
     }
-
-    return false;
 }
 
 bool ntf_to_injector(const char* data, const int len) {
index e4bf3f4c10416daebbdb98a288aac09eb0dce533..8c2faa1f6b2afee6d65f36a45385c85371639ac1 100644 (file)
@@ -79,6 +79,7 @@ bool send_to_nfc(unsigned char id, unsigned char type, const char* data, const u
 
     if(len > MAX_BUF_SIZE) {
         ERR("the length of data is longer than max buffer size");
+        free(_msg);
         return false;
     }
 
index ece46bad2e8eaf5236019590d5b3836aecf013c5..30115918df3cc9478c9d8c51e3c520f1d222872f 100644 (file)
@@ -61,6 +61,10 @@ inline void download_url(char *url)
     curl = curl_easy_init();
     if (curl) {
         fp = fopen(pac_tempfile, "wb");
+        if(fp == NULL) {
+            ERR("failed to fopen(): %s\n", pac_tempfile);
+            return;
+        }
         curl_easy_setopt(curl, CURLOPT_URL, url);
         curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
         /* just in case network does not work */