PVS-studio error fix 42/136242/1 accepted/tizen_3.0_common accepted/tizen_3.0_ivi accepted/tizen_3.0_mobile accepted/tizen_3.0_tv accepted/tizen_3.0_wearable tizen_3.0 accepted/tizen/3.0/common/20170630.144430 accepted/tizen/3.0/ivi/20170630.081504 accepted/tizen/3.0/mobile/20170630.081412 accepted/tizen/3.0/tv/20170630.081221 accepted/tizen/3.0/wearable/20170630.081441 submit/tizen_3.0/20170629.033256
authorJiyong Min <jiyong.min@samsung.com>
Thu, 8 Jun 2017 05:57:03 +0000 (14:57 +0900)
committerJiyong Min <jiyong.min@samsung.com>
Thu, 29 Jun 2017 00:21:07 +0000 (00:21 +0000)
(https://www.slideshare.net/Andrey_Karpov/pvsstudio-is-ready-to-improve-the-code-of-tizen-operating-system)

Change-Id: Ida15c5c2a90042dcc485b4d6da4e456f1c8ca97a
Signed-off-by: Jiyong Min <jiyong.min@samsung.com>
(cherry picked from commit 35cd7a32db4aa607331cd288ee2b1f6605292cb2)

decode-test/image_util_decode_encode_testsuite.c
packaging/capi-media-image-util.spec

index e1da5462bd07fddde2f5d7fbf5d2f253539135e5..d495481bff39ace3e0cebdba3a3dc4d9b11f9b72 100755 (executable)
@@ -188,9 +188,7 @@ int main(int argc, char *argv[])
                0,};
                unsigned char *animated_data[1000] = {NULL, };
                memset(gif_filename, 0, BUFFER_SIZE);
-               {
-                       snprintf(gif_filename, BUFFER_SIZE, "%s%s", DECODE_RESULT_PATH, "gif");
-               }
+               snprintf(gif_filename, BUFFER_SIZE, "%s%s", DECODE_RESULT_PATH, "gif");
 
                if ((fd = opendir(argv[2])) == NULL) {
                        fprintf(stderr, "listdir: can't open %s\n", argv[2]);
@@ -198,12 +196,20 @@ int main(int argc, char *argv[])
                }
 
                while ((dp = readdir(fd)) != NULL) {
+                       if (dp->d_name == NULL)
+                               continue;
                        if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, ".."))
                                continue;               /* skip self and parent */
                        if (!number_files) {
                                char *temp1 = strstr(dp->d_name, "-");
                                char *temp2 = strstr(dp->d_name, ".");
 
+                               if (temp1 == NULL || temp2 == NULL) {
+                                       fprintf(stderr, "\t\tCannot find test format\n");
+                                       closedir(fd);
+                                       return 0;
+                               }
+
                                strncpy(temp_filename, dp->d_name, strlen(dp->d_name) - strlen(temp1));
                                strncpy(file_format, temp2, strlen(temp2));
                        }
index fed7ce40b2e3be0bce98772fe095c5e09a7eec59..3a10007e478892f3209a85911fb030ea7a183fa8 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-media-image-util
 Summary:    A Image Utility library in Tizen Native API
-Version:    0.1.15
+Version:    0.1.16
 Release:    2
 Group:      Multimedia/API
 License:    Apache-2.0