]> git.ipfire.org Git - thirdparty/bash.git/blobdiff - assoc.c
commit bash-20140912 snapshot
[thirdparty/bash.git] / assoc.c
diff --git a/assoc.c b/assoc.c
index 5d3cd11bc3997cdc3d936859e5334d0fc6164e5a..5499043717ab9cb2f6a538f78422e2fcacc4b40c 100644 (file)
--- a/assoc.c
+++ b/assoc.c
@@ -277,7 +277,10 @@ int starsub, quoted;
   for (i = 1; l && i < start; i++)
     l = l->next;
   if (l == 0)
-    return ((char *)NULL);
+    {
+      dispose_words (save);
+      return ((char *)NULL);
+    }
   for (j = 0,h = t = l; l && j < nelem; j++)
     {
       t = l;
@@ -533,7 +536,7 @@ assoc_to_string (h, sep, quoted)
     return (savestring (""));
 
   result = NULL;
-  list = NULL;
+  l = list = NULL;
   /* This might be better implemented directly, but it's simple to implement
      by converting to a word list first, possibly quoting the data, then
      using list_string */
@@ -551,6 +554,8 @@ assoc_to_string (h, sep, quoted)
   l = REVERSE_LIST(list, WORD_LIST *);
 
   result = l ? string_list_internal (l, sep) : savestring ("");
+  dispose_words (l);  
+
   return result;
 }