diff options
author | Seungha Son <seungha.son@samsung.com> | 2017-08-02 17:41:17 +0900 |
---|---|---|
committer | Seungha Son <seungha.son@samsung.com> | 2017-08-03 17:43:28 +0900 |
commit | 8b7e6a2cdf036ac53a85ba95f04dda577ff1bf0c (patch) | |
tree | 3f13f76855a930f249393d4f4768c1aa71525a8a | |
parent | 5be2cb6222bf5c4b650626244f11f1a30f3335f6 (diff) | |
download | pkgmgr-server-accepted/tizen_3.0_mobile.tar.gz pkgmgr-server-accepted/tizen_3.0_mobile.tar.bz2 pkgmgr-server-accepted/tizen_3.0_mobile.zip |
Add null checksubmit/tizen_3.0/20170815.233247accepted/tizen/3.0/wearable/20170816.131103accepted/tizen/3.0/tv/20170816.131042accepted/tizen/3.0/mobile/20170816.131124accepted/tizen/3.0/ivi/20170816.131217accepted/tizen/3.0/common/20170816.145137accepted/tizen_3.0_wearableaccepted/tizen_3.0_tvaccepted/tizen_3.0_mobileaccepted/tizen_3.0_iviaccepted/tizen_3.0_common
Signed-off-by: Seungha Son <seungha.son@samsung.com>
Change-Id: I76149b658e6cd20aef116c5d074c17a43d05b819
-rw-r--r-- | src/queue.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/queue.c b/src/queue.c index 61220c8..a03ed07 100644 --- a/src/queue.c +++ b/src/queue.c @@ -101,6 +101,11 @@ int _push_queue(uid_t target_uid, uid_t caller_uid, const char *req_id, } job = calloc(1, sizeof(struct backend_job)); + if (job == NULL) { + ERR("Out of memory"); + return -1; + } + job->target_uid = target_uid; job->caller_uid = caller_uid; if (req_id) @@ -132,10 +137,21 @@ static int __init_backends(const char *fpath, const struct stat *sb, return 0; queue = calloc(1, sizeof(struct backend_queue)); + if (queue == NULL) { + ERR("Out of memory"); + return -1; + } + if (typeflag == FTW_F) { queue->path = strdup(fpath); } else if (typeflag == FTW_SL) { queue->path = malloc(sb->st_size + 1); + if (queue->path == NULL) { + ERR("Out of memory"); + free(queue); + return -1; + } + r = readlink(fpath, queue->path, sb->st_size + 1); if (r < 0 || r > sb->st_size) { ERR("failed to readlink for %s", fpath); |