static void __del_file(GHashTable *valid_file_list, char *path)
{
- struct dirent **items;
+ struct dirent **items = NULL;
struct stat fstat;
char abs_path[1024] = {0, };
char cwd[1024] = {0, };
ret = snprintf(abs_path, 1024 - 1, "%s/%s", cwd, items[i]->d_name);
if (ret < 0 || ret > 1024 -1 ) {
printf("snprintf fail\n");
- return;
+ goto catch;
}
if (g_lstat(abs_path, &fstat) != 0) {
printf("failed to get info[%s]\n", abs_path);
- return;
+ goto catch;
}
if ((fstat.st_mode & S_IFDIR) == S_IFDIR) {
__del_file(valid_file_list, abs_path);
}
}
}
+
+catch:
+ if (items) {
+ for (i = 0; i < nitems; i++)
+ free(items[i]);
+ free(items);
+ }
}
static int __process_slice(rsc_tool_args *data)