util: str_list_unique() bugfix
authorKamen Mazdrashki <kamen.mazdrashki@postpath.com>
Fri, 13 Nov 2009 01:57:48 +0000 (03:57 +0200)
committerKarolin Seeger <kseeger@samba.org>
Thu, 26 Nov 2009 10:40:53 +0000 (11:40 +0100)
j is actually the index of the last element in the list
size of the list though is j+1 <- to make room for the
terminating NULL element
(cherry picked from commit 5b75201dbb9f2e6799fd5c3eee8da6230caee96c)
(cherry picked from commit 8a5c8d559e6b34544a3cc0811d269d46bcad5182)

lib/util/util_strlist.c

index 1331fee6a70c9c9a753c09dcfe4e16638926c1e8..8d69eef23336fd8830684b4b73b664260222295f 100644 (file)
@@ -401,7 +401,7 @@ _PUBLIC_ const char **str_list_unique(const char **list)
                }
        }
        list[j] = NULL;
-       list = talloc_realloc(NULL, list, const char *, j);
+       list = talloc_realloc(NULL, list, const char *, j + 1);
        talloc_free(list2);
        return list;
 }