Fix WGID 259685 01/163001/1 accepted/tizen/5.0/unified/20181102.030548 accepted/tizen/unified/20171207.070212 submit/tizen/20171207.041932 submit/tizen_5.0/20181101.000007
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:11:08 +0000 (10:11 +0900)
Change-Id: I2a7c85ffa7eb5e3ddd99de2bc92bba7e3ae1be77
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
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);