headerGetStringArrayEntry: add missing terminator
This commit is contained in:
parent
8836c8f87b
commit
6e5e4496d7
@ -189,13 +189,15 @@ headerGetStringArrayEntry(Header h, const int tag, int* count)
|
||||
if (headerGet(h, tag, td, HEADERGET_MINMEM) && rpmtdType(td) == RPM_STRING_ARRAY_TYPE && rpmtdCount(td) >= 1) {
|
||||
*count = rpmtdCount(td);
|
||||
if (*count > 0) {
|
||||
st = malloc(sizeof(char*) * *count);
|
||||
st = malloc(sizeof(char*) * (*count + 1));
|
||||
const char* str;
|
||||
rpmtdInit(td);
|
||||
while ((str = rpmtdNextString(td))) {
|
||||
st[i] = strdup(str);
|
||||
i++;
|
||||
}
|
||||
// Terminator
|
||||
st[i] = NULL;
|
||||
rpmtdFree(td);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user