Fix memory leak for invalid picture path 47/242247/3 accepted/tizen/unified/20200829.113351 submit/tizen/20200827.012435
authorjiyong.min <jiyong.min@samsung.com>
Tue, 25 Aug 2020 07:23:51 +0000 (16:23 +0900)
committerjiyong.min <jiyong.min@samsung.com>
Wed, 26 Aug 2020 23:03:12 +0000 (08:03 +0900)
Change-Id: I91cc461446c8a98ecc18959a31c8d2c39b7afd5b

packaging/capi-media-metadata-editor.spec
src/metadata_editor.cpp

index fc80a35..45056c2 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-media-metadata-editor
 Summary:    A metadata editor library in Tizen Native API
-Version: 0.2.1
+Version: 0.2.2
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 048986c..17a6478 100755 (executable)
@@ -556,8 +556,9 @@ static int __metadata_editor_get_picture_info(const char *path, char **picture,
 {
        int ret = METADATA_EDITOR_ERROR_NONE;
        GError *error = NULL;
+       char *mime_type = NULL;
 
-       ret = __metadata_editor_get_picture_type(path, type);
+       ret = __metadata_editor_get_picture_type(path, &mime_type);
        if (ret != METADATA_EDITOR_ERROR_NONE)
                return ret;
 
@@ -569,8 +570,13 @@ static int __metadata_editor_get_picture_info(const char *path, char **picture,
                        ret = METADATA_EDITOR_ERROR_PERMISSION_DENIED;
 
                g_error_free (error);
+               g_free(mime_type);
+
+               return ret;
        }
 
+       *type = mime_type;
+
        return ret;
 }