Fix memory leak 67/111967/1
authorJunghyun Yeon <jungh.yeon@samsung.com>
Wed, 25 Jan 2017 07:12:22 +0000 (16:12 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Wed, 25 Jan 2017 07:12:22 +0000 (16:12 +0900)
Change-Id: I23853c597a9446e8e12d7f9ab211844be6d28ae2
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
client/src/pkgmgr.c

index 7246abab705d3d7ef6738eb0fd736945230ee865..a7d5d4f4a1c0dc4cf0f8d4970de1b959c72cf925 100644 (file)
@@ -396,7 +396,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) {
@@ -419,9 +418,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) {
@@ -439,7 +435,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) {
@@ -555,7 +551,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) {
@@ -578,9 +573,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) {
@@ -596,7 +588,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) {