Fix WGID 259685 02/163002/1 accepted/tizen/4.0/unified/20171208.061655 submit/tizen_4.0/20171207.042002 submit/tizen_4.0/20171207.062616 tizen_4.0.IoT.p2_release
authorsaerome.kim <saerome.kim@samsung.com>
Wed, 6 Dec 2017 12:50:24 +0000 (21:50 +0900)
committersaerome kim <saerome.kim@samsung.com>
Thu, 7 Dec 2017 01:15:43 +0000 (01:15 +0000)
Change-Id: I2a7c85ffa7eb5e3ddd99de2bc92bba7e3ae1be77
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
(cherry picked from commit 0f2b28f395a993f4809db74ca570715164988834)

examples/pathutils.c [changed mode: 0755->0644]

old mode 100755 (executable)
new mode 100644 (file)
index c51214c..b7eff18
@@ -1,4 +1,4 @@
-/** 
+/**
  * \file pathutils.c
  *
  * Copyright (C) 2005-2008 Linus Walleij <triad@df.lth.se>
@@ -31,7 +31,7 @@
 static uint32_t
 lookup_folder_id (LIBMTP_folder_t * folder, char * path, char * parent)
 {
-  char * current;
+  char * current = NULL;
   uint32_t ret = (uint32_t) -1;
 
   if (strcmp(path,"/")==0)
@@ -42,6 +42,10 @@ lookup_folder_id (LIBMTP_folder_t * folder, char * path, char * parent)
   }
 
   current = malloc (strlen(parent) + strlen(folder->name) + 2);
+  if (current == NULL) {
+    printf("Memory allocation failure\n");
+    return ret;
+  }
   snprintf(current,strlen(parent)+strlen(folder->name)+1,"%s/%s",parent,folder->name);
   if (strcasecmp (path, current) == 0) {
     free (current);