check the return value of function 'dlsym' 79/239979/4
authorchengyj1985 <yujie.cheng@samsung.com>
Fri, 31 Jul 2020 07:48:52 +0000 (15:48 +0800)
committerhj kim <backto.kim@samsung.com>
Mon, 3 Aug 2020 02:56:37 +0000 (02:56 +0000)
Change-Id: I79eeb96115e4b74fccec0f0073ae22bd03833c64

src/mediadb-update.c

index 787592b..8396c33 100755 (executable)
@@ -80,7 +80,12 @@ static void __check_media_db(void)
                return;
        }
 
-       svc_check_db                    = dlsym(funcHandle, "check_db");
+       svc_check_db = dlsym(funcHandle, "check_db");
+       if (svc_check_db == NULL) {
+               printf("find check_db failed\n");
+               dlclose(funcHandle);
+               return;
+       }
 
        ret = media_db_connect(&db_handle, tzplatform_getuid(TZ_USER_NAME), false);
        if (ret < 0)
@@ -114,7 +119,12 @@ static int __get_storage_id(const char *path, char *storage_id, uid_t uid)
                return -1;
        }
 
-       svc_get_storage_id      = dlsym(funcHandle, "get_storage_id");
+       svc_get_storage_id = dlsym(funcHandle, "get_storage_id");
+       if (svc_get_storage_id == NULL) {
+               printf("find get_storage_id failed\n");
+               dlclose(funcHandle);
+               return -1;
+       }
 
        ret = media_db_connect(&db_handle, uid, false);
        if (ret < 0) {