From: Lucas De Marchi Date: Tue, 20 Dec 2011 05:09:58 +0000 (-0200) Subject: Terminate strv with NULL X-Git-Tag: v2~27 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3267026e0b18e25a754b7c71956256bd6232258b;p=platform%2Fupstream%2Fkmod.git Terminate strv with NULL --- diff --git a/libkmod/libkmod-elf.c b/libkmod/libkmod-elf.c index 4438120..7bd73fc 100644 --- a/libkmod/libkmod-elf.c +++ b/libkmod/libkmod-elf.c @@ -433,10 +433,11 @@ int kmod_elf_get_strings(const struct kmod_elf *elf, const char *section, char * if (strings[i - 1] != '\0') count++; - *array = a = malloc(size + 1 + sizeof(char *) * count); + *array = a = malloc(size + 1 + sizeof(char *) * (count + 1)); if (*array == NULL) return -errno; + a[count] = NULL; itr = (char *)(a + count); last = 0; for (i = 0, count = 0; i < size; i++) {