Fix the bug that local variable can't be assigned by sdcard api. 54/126654/2
authorjongmyeongko <jongmyeong.ko@samsung.com>
Mon, 24 Apr 2017 12:16:46 +0000 (21:16 +0900)
committerjongmyeongko <jongmyeong.ko@samsung.com>
Tue, 25 Apr 2017 04:14:25 +0000 (13:14 +0900)
this can cause the crash issue when there is no sdcard.

Change-Id: Ie7608e6b26e29422eaee2e06c7f7daf54f2673b7
Signed-off-by: jongmyeongko <jongmyeong.ko@samsung.com>
src/pkg_getsize.c

index 51c62707b5915f09f5142a7ed053b43dfd63f1cf..6b68a7a04e9212d2db88d25983b6e62fcfb7518e 100644 (file)
@@ -84,11 +84,9 @@ static int __get_sdcard_path(char **sdpath)
                return -1;
 
        ret = storage_get_primary_sdcard(&storage_id, sdpath);
-       if (ret != STORAGE_ERROR_NONE) {
-               if (*sdpath)
-                       free(*sdpath);
+       if (ret != STORAGE_ERROR_NONE)
                return -1;
-       }
+
        return 0;
 }
 
@@ -96,7 +94,7 @@ static char *__get_external_tep_path_by_handle(pkgmgrinfo_pkginfo_h handle)
 {
        int ret;
        char *result_path;
-       char *sdpath;
+       char *sdpath = NULL;
 
        ret = pkgmgrinfo_pkginfo_get_tep_name(handle, &result_path);
        if (ret != PMINFO_R_OK)