X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fqueue.c;h=a03ed07b9143ddb2345663339bc81ad4c932299b;hb=25b1a2752dac7663fed25e0155e04c5272e37f38;hp=61220c8e35ad5f8fc04cae2a7ed7c6aa2da508e5;hpb=15a52686f6b187f7cbd2bb48be7c8ae765060319;p=platform%2Fcore%2Fappfw%2Fpkgmgr-server.git 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);