-/**
+/**
* \file pathutils.c
*
* Copyright (C) 2005-2008 Linus Walleij <triad@df.lth.se>
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)
}
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);