Fix the invalid list item handling code.
authorSung-jae Park <nicesj.park@samsung.com>
Sun, 30 Jun 2013 11:26:51 +0000 (20:26 +0900)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Mon, 1 Jul 2013 12:16:51 +0000 (12:16 +0000)
List doesn't remove the released item.
So it can generate the crash while crawling the list.

Change-Id: I27eb10482353d690dca5380a70937adaebf4e798

src/pkgmgr.c

index 49f0a86..316148f 100644 (file)
@@ -208,7 +208,6 @@ static int start_cb(const char *pkgname, const char *val, void *data)
        }
 
        item->status = PKGMGR_STATUS_START;
-       s_info.item_list = eina_list_append(s_info.item_list, item);
 
        if (!strcasecmp(val, "download")) {
                item->type = PKGMGR_EVENT_DOWNLOAD;
@@ -227,6 +226,8 @@ static int start_cb(const char *pkgname, const char *val, void *data)
                return LB_STATUS_ERROR_INVALID;
        }
 
+       s_info.item_list = eina_list_append(s_info.item_list, item);
+
        invoke_callback(pkgname, item, 0.0f);
        return LB_STATUS_SUCCESS;
 }