From 1fc2ce2bc4ba585784d41ef80f31d33b6b181aea Mon Sep 17 00:00:00 2001 From: "munkyu.im" Date: Thu, 26 Dec 2013 16:31:36 +0900 Subject: [PATCH] qemu: remove prevent issue added to check null pointer. added to check lock/unlock. Change-Id: I98e3fd8a297bb7a7df1149657606cf3d74522f2f Signed-off-by: munkyu.im --- tizen/src/debug_ch.c | 6 +++++- tizen/src/ecs/ecs.c | 1 + tizen/src/ecs/ecs_msg.c | 5 +++-- tizen/src/hw/maru_virtio_nfc.c | 1 + tizen/src/osutil.c | 4 ++++ 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/tizen/src/debug_ch.c b/tizen/src/debug_ch.c index af99ce9..32fb5f2 100644 --- a/tizen/src/debug_ch.c +++ b/tizen/src/debug_ch.c @@ -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; diff --git a/tizen/src/ecs/ecs.c b/tizen/src/ecs/ecs.c index 7bbd271..37f409b 100644 --- a/tizen/src/ecs/ecs.c +++ b/tizen/src/ecs/ecs.c @@ -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; } } diff --git a/tizen/src/ecs/ecs_msg.c b/tizen/src/ecs/ecs_msg.c index 8bd31b3..4369b82 100644 --- a/tizen/src/ecs/ecs_msg.c +++ b/tizen/src/ecs/ecs_msg.c @@ -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) { diff --git a/tizen/src/hw/maru_virtio_nfc.c b/tizen/src/hw/maru_virtio_nfc.c index e4bf3f4..8c2faa1 100644 --- a/tizen/src/hw/maru_virtio_nfc.c +++ b/tizen/src/hw/maru_virtio_nfc.c @@ -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; } diff --git a/tizen/src/osutil.c b/tizen/src/osutil.c index ece46ba..3011591 100644 --- a/tizen/src/osutil.c +++ b/tizen/src/osutil.c @@ -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 */ -- 2.7.4