diff options
author | ywan171 <yi.a.wang@intel.com> | 2013-01-15 22:59:23 +0800 |
---|---|---|
committer | Patrick Tjin <pattjin@google.com> | 2014-07-21 22:03:40 -0700 |
commit | 8af4549cec855377507046127d9b9a45911eaf04 (patch) | |
tree | c352fbd9190990cf5667c270f864243685c721b7 /utils | |
parent | 85d33bdb86649f8daa474948f3224cc0a6c160ce (diff) | |
download | wrs_omxil_core-8af4549cec855377507046127d9b9a45911eaf04.tar.gz |
wrs_omxil_core: fix klocwork issue under wrs_omxil_core
BZ: 73428
fix Klocwork issue under wrs_omxil_core, check point before refereced
Signed-off-by: ywan171 <yi.a.wang@intel.com>
Change-Id: Ic5b721a5cda4dacb0b89dc28bdf9aaad605e1d5a
Reviewed-on: http://android.intel.com:8080/86803
Reviewed-by: Wang, Yi A <yi.a.wang@intel.com>
Reviewed-by: Feng, Wei <wei.feng@intel.com>
Reviewed-by: Shi, PingX <pingx.shi@intel.com>
Tested-by: Shi, PingX <pingx.shi@intel.com>
Reviewed-by: cactus <cactus@intel.com>
Tested-by: cactus <cactus@intel.com>
Diffstat (limited to 'utils')
-rw-r--r-- | utils/src/module.c | 14 | ||||
-rw-r--r-- | utils/src/queue.c | 3 |
2 files changed, 9 insertions, 8 deletions
diff --git a/utils/src/module.c b/utils/src/module.c index 5f5f49d..053e5e0 100644 --- a/utils/src/module.c +++ b/utils/src/module.c @@ -167,10 +167,15 @@ struct module *module_open(const char *file, int flag) return existing; } + new->name = strdup(file); + if (!new->name) { + goto free_handle; + } + dlerror(); new->init = dlsym(new->handle, "module_init"); dlerr = dlerror(); - if (!dlerr) { + if (!dlerr && new->init) { LOGE("module %s has init(), call the symbol\n", new->name); init_ret = new->init(new); } @@ -187,13 +192,6 @@ struct module *module_open(const char *file, int flag) if (dlerr) new->exit = NULL; - new->name = strdup(file); - if (!new->name) { - if (new->exit) - new->exit(new); - goto free_handle; - } - g_module_head = module_add_list(g_module_head, new); pthread_mutex_unlock(&g_lock); diff --git a/utils/src/queue.c b/utils/src/queue.c index 6e54502..015fbf7 100644 --- a/utils/src/queue.c +++ b/utils/src/queue.c @@ -78,6 +78,9 @@ int queue_push_head(struct queue *queue, void *data) void __queue_push_tail(struct queue *queue, struct list *entry) { + if (!entry) { + return ; + } queue->tail = list_add_tail(queue->tail, entry); if (queue->tail->next) queue->tail = queue->tail->next; |