This patch removes double free and leakages.
Change-Id: Ic8bed9d6ea9efd409005a56eada078978b498461
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
if (b == NULL) {
_E("out of memory");
aul_sock_send_raw_with_fd(fd, APP_GET_INFO_ERROR,
- NULL, 0, AUL_SOCK_NOREPLY);
- return -1;
+ NULL, 0, AUL_SOCK_ASYNC);
+ return -ENOMEM;
}
ret = bundle_encode(b, &raw, &len);
if (ret != BUNDLE_ERROR_NONE) {
_E("Failed to encode bundle");
aul_sock_send_raw_with_fd(fd, APP_GET_INFO_ERROR, NULL,
- 0, AUL_SOCK_NOREPLY);
- return -1;
+ 0, AUL_SOCK_ASYNC);
+ return -ENOMEM;
}
ret = aul_sock_send_raw_with_fd(fd, APP_GET_INFO_OK,
ret = __send_running_appinfo(app_status, fd);
if (ret < 0) {
+ close(fd);
g_slist_free(list);
- return -1;
+ return ret;
}
}
close(fd);
}
ret = __send_running_appinfo(app_status, fd);
+ close(fd);
if (ret < 0)
return ret;
- close(fd);
_I("[APP_CONTEXT_GET] result: %d", ret);
return 0;
}
}
ret = __send_running_appinfo(app_status, fd);
+ close(fd);
if (ret < 0)
return ret;
- close(fd);
_I("[APP_CONTEXT_GET_BY_INSTANCE_ID] result: %d", ret);
return 0;
}
}
ret = __send_running_appinfo(app_status, fd);
+ close(fd);
if (ret < 0)
return ret;
- close(fd);
_I("[APP_CONTEXT_GET_BY_PID] result: %d", ret);
return 0;
}
bool _app_status_is_debug_mode(app_status_h app_status)
{
return app_status->debug_mode;
-}
\ No newline at end of file
+}
g_source_remove(info->timer);
if (info->seq)
free(info->seq);
+ if (info->fd > 0)
+ close(info->fd);
free(info);
}
const char *seq;
struct timespec end;
unsigned int interval;
+ int fd;
if (pid <= 0)
return;
clock_gettime(CLOCK_MONOTONIC, &end);
interval = __get_timeout_interval(_request_get_start_time(req), &end);
- info = __create_result_info(interval, pid,
- _request_remove_fd(req), seq);
+ fd = _request_remove_fd(req);
+ info = __create_result_info(interval, pid, fd, seq);
if (!info) {
_E("Failed to create result info");
+ close(fd);
return;
}
if (info) {
res = aul_sock_send_bundle_with_fd(info->fd, pgid, kb,
AUL_SOCK_NOREPLY);
+ info->fd = -1;
__remove_result_info(info);
__destroy_result_info(info);
} else {
if (b == NULL) {
LOGE("Failed to create bundle");
aul_sock_send_raw_with_fd(fd, APP_GET_INFO_ERROR,
- NULL, 0, AUL_SOCK_NOREPLY);
+ NULL, 0, AUL_SOCK_ASYNC);
return -1;
}
if (b_raw == NULL) {
LOGE("Failed to encode bundle");
aul_sock_send_raw_with_fd(fd, APP_GET_INFO_ERROR,
- NULL, 0, AUL_SOCK_NOREPLY);
+ NULL, 0, AUL_SOCK_ASYNC);
bundle_free(b);
return -1;
}