added to check null pointer.
added to check lock/unlock.
Change-Id: I98e3fd8a297bb7a7df1149657606cf3d74522f2f
Signed-off-by: munkyu.im <munkyu.im@samsung.com>
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;
}
else {
LOG("unsupported category is found: %s", msg->category);
+ pthread_mutex_unlock(&mutex_clilist);
goto fail;
}
}
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) {
if(len > MAX_BUF_SIZE) {
ERR("the length of data is longer than max buffer size");
+ free(_msg);
return false;
}
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 */