summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/rpmfi.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/rpmfi.c b/lib/rpmfi.c
index 1f5ca7a20..d36263248 100644
--- a/lib/rpmfi.c
+++ b/lib/rpmfi.c
@@ -1626,8 +1626,10 @@ static uint8_t *base2bin(Header h, rpmTagVal tag, rpm_count_t num, int *len)
t = bin = xcalloc(num, maxlen);
for (i = 0; i < num; i++) {
- memcpy(t, arr[i], lengths[i]);
- free(arr[i]);
+ if (arr[i]) {
+ memcpy(t, arr[i], lengths[i]);
+ free(arr[i]);
+ }
t += maxlen;
}
*len = maxlen;