summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorportix <none@none>2012-06-25 09:22:00 +0200
committerportix <none@none>2012-06-25 09:22:00 +0200
commit7d74c2686f972ba416f128a17246aff298f18865 (patch)
tree5ab6009ec4449d03745e93205050c9e6b38aed82 /src
parentcab6bc0ed6119d747f31569f041c731b26368dba (diff)
downloaddwb-7d74c2686f972ba416f128a17246aff298f18865.zip
Freeing temporary GSList in io_dir_names
Diffstat (limited to 'src')
-rw-r--r--src/scripts.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/scripts.c b/src/scripts.c
index 64fd7a0c..4cba9e14 100644
--- a/src/scripts.c
+++ b/src/scripts.c
@@ -1132,10 +1132,10 @@ io_dir_names(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, siz
GDir *dir;
char *dir_name = js_value_to_char(ctx, argv[0], PATH_MAX, exc);
const char *name;
- GSList *list = NULL;
if (dir_name == NULL)
return JSValueMakeNull(ctx);
if ((dir = g_dir_open(dir_name, 0, NULL)) != NULL) {
+ GSList *list = NULL;
while ((name = g_dir_read_name(dir)) != NULL) {
list = g_slist_prepend(list, (gpointer)js_char_to_value(ctx, name));
}
@@ -1145,6 +1145,7 @@ io_dir_names(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, siz
for (GSList *l = list; l; l=l->next, i++)
args[i] = l->data;
ret = JSObjectMakeArray(ctx, i, args, exc);
+ g_slist_free(list);
}
else
ret = JSValueMakeNull(ctx);