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) {
|
if (headerGet(h, tag, td, HEADERGET_MINMEM) && rpmtdType(td) == RPM_STRING_ARRAY_TYPE && rpmtdCount(td) >= 1) {
|
||||||
*count = rpmtdCount(td);
|
*count = rpmtdCount(td);
|
||||||
if (*count > 0) {
|
if (*count > 0) {
|
||||||
st = malloc(sizeof(char*) * *count);
|
st = malloc(sizeof(char*) * (*count + 1));
|
||||||
const char* str;
|
const char* str;
|
||||||
rpmtdInit(td);
|
rpmtdInit(td);
|
||||||
while ((str = rpmtdNextString(td))) {
|
while ((str = rpmtdNextString(td))) {
|
||||||
st[i] = strdup(str);
|
st[i] = strdup(str);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
// Terminator
|
||||||
|
st[i] = NULL;
|
||||||
rpmtdFree(td);
|
rpmtdFree(td);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user