Fix memory leak 30/112430/1 accepted/tizen/3.0/common/20170208.145411 accepted/tizen/3.0/ivi/20170208.084112 accepted/tizen/3.0/mobile/20170208.084006 accepted/tizen/3.0/tv/20170208.084033 accepted/tizen/3.0/wearable/20170208.084054 submit/tizen_3.0/20170207.053424
authorJunghyun Yeon <jungh.yeon@samsung.com>
Wed, 25 Jan 2017 07:12:22 +0000 (16:12 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Wed, 1 Feb 2017 02:17:21 +0000 (11:17 +0900)
Change-Id: I23853c597a9446e8e12d7f9ab211844be6d28ae2
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
client/src/pkgmgr.c

index 7fd16d5..c146029 100644 (file)
@@ -404,7 +404,6 @@ API int pkgmgr_client_usr_install(pkgmgr_client *pc, const char *pkg_type,
        GVariantBuilder *builder = NULL;
        GVariant *args = NULL;
        struct pkgmgr_client_t *client = (struct pkgmgr_client_t *)pc;
-       char *pkgtype = NULL;
        struct cb_info *cb_info;
 
        if (pc == NULL || pkg_path == NULL) {
@@ -427,9 +426,6 @@ API int pkgmgr_client_usr_install(pkgmgr_client *pc, const char *pkg_type,
                return PKGMGR_R_EINVAL;
        }
 
-       if (pkg_type)
-               pkgtype = strdup(pkg_type);
-
        /* build arguments */
        builder = g_variant_builder_new(G_VARIANT_TYPE("as"));
        if (client->tep_path) {
@@ -447,7 +443,7 @@ API int pkgmgr_client_usr_install(pkgmgr_client *pc, const char *pkg_type,
        g_variant_builder_unref(builder);
 
        ret = pkgmgr_client_connection_send_request(client, "install",
-                       g_variant_new("(uss@as)", uid, pkgtype ? pkgtype : "",
+                       g_variant_new("(uss@as)", uid, pkg_type ? pkg_type : "",
                                pkg_path, args),
                        &result);
        if (ret != PKGMGR_R_OK) {
@@ -563,7 +559,6 @@ API int pkgmgr_client_usr_mount_install(pkgmgr_client *pc, const char *pkg_type,
        GVariantBuilder *builder = NULL;
        GVariant *args = NULL;
        struct pkgmgr_client_t *client = (struct pkgmgr_client_t *)pc;
-       char *pkgtype = NULL;
        struct cb_info *cb_info;
 
        if (pc == NULL || pkg_path == NULL) {
@@ -586,9 +581,6 @@ API int pkgmgr_client_usr_mount_install(pkgmgr_client *pc, const char *pkg_type,
                return PKGMGR_R_EINVAL;
        }
 
-       if (pkg_type)
-               pkgtype = strdup(pkg_type);
-
        /* build arguments */
        builder = g_variant_builder_new(G_VARIANT_TYPE("as"));
        if (client->tep_path) {
@@ -604,7 +596,7 @@ API int pkgmgr_client_usr_mount_install(pkgmgr_client *pc, const char *pkg_type,
        g_variant_builder_unref(builder);
 
        ret = pkgmgr_client_connection_send_request(client, "mount_install",
-                       g_variant_new("(uss@as)", uid, pkgtype ? pkgtype : "",
+                       g_variant_new("(uss@as)", uid, pkg_type ? pkg_type : "",
                                pkg_path, args),
                        &result);
        if (ret != PKGMGR_R_OK) {