{\r
int newlen;\r
char *p, *newdir;\r
- if (!(inp & PBTN_MOK)) continue;\r
+ if (!(inp & PBTN_MOK))\r
+ continue;\r
newlen = strlen(curr_path) + strlen(namelist[sel+1]->d_name) + 2;\r
newdir = malloc(newlen);\r
+ if (newdir == NULL)\r
+ break;\r
if (strcmp(namelist[sel+1]->d_name, "..") == 0) {\r
char *start = curr_path;\r
p = start + strlen(start) - 1;\r
free(namelist);\r
}\r
\r
+ // restore curr_path\r
+ if (fname != NULL) {\r
+ n = strlen(curr_path);\r
+ if (curr_path + n + 1 == fname)\r
+ curr_path[n] = '/';\r
+ }\r
+\r
return ret;\r
}\r
\r