csr_cs_context_destroy should be invoked.
Change-Id: I8a57241a28c9bbf4024e3904197409c7e27fb11d
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
{
int ret;
void *context;
{
int ret;
void *context;
void *lib_handle;
int (*_csr_cs_context_create)(void **handle);
int (*_csr_cs_scan_file)(void *handle, const char *file_path, void **malware);
void *lib_handle;
int (*_csr_cs_context_create)(void **handle);
int (*_csr_cs_scan_file)(void *handle, const char *file_path, void **malware);
if (!_csr_cs_context_create || !_csr_cs_scan_file ||
!_csr_cs_context_destroy) {
ERR("Failed to load CSR symbols");
if (!_csr_cs_context_create || !_csr_cs_scan_file ||
!_csr_cs_context_destroy) {
ERR("Failed to load CSR symbols");
- ret = -1;
- goto catch;
+ dlclose(lib_handle);
+ return -1;
}
ret = _csr_cs_context_create(&context);
if (ret != 0) {
ERR("Failed to create context");
}
ret = _csr_cs_context_create(&context);
if (ret != 0) {
ERR("Failed to create context");
- ret = -1;
- goto catch;
+ dlclose(lib_handle);
+ return -1;
}
ret = _csr_cs_scan_file(context, path, &malware);
}
ret = _csr_cs_scan_file(context, path, &malware);
+ /* the csr engine may not exist */
+ if (ret != 0)
DBG("CSR result[%d]", ret);
DBG("CSR result[%d]", ret);
- ret = 0;
- goto catch;
- }
ret = _csr_cs_context_destroy(context);
ret = _csr_cs_context_destroy(context);
ERR("Failed to destroy context");
ERR("Failed to destroy context");
- ret = -1;
- goto catch;
- }
if (malware != NULL) {
ERR("CSR detected malware from [%s]", path);
if (malware != NULL) {
ERR("CSR detected malware from [%s]", path);
+ return -1;
+ } else {
+ return 0;
-
-catch:
- if (lib_handle)
- dlclose(lib_handle);
-
- return ret;
}
static int __kill_app(char *appid, uid_t uid)
}
static int __kill_app(char *appid, uid_t uid)