summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-04-30 10:32:57 +0300
committerPanu Matilainen <pmatilai@redhat.com>2008-04-30 10:32:57 +0300
commitd4d4a29f8dd2497607fd375f4966abb48a1c522c (patch)
tree72340c38d520d8b01dd660809ffcddc6870b37dc
parent657dc38ec051d3333dad5cb15c6cb7a884c151e4 (diff)
downloadrpm-d4d4a29f8dd2497607fd375f4966abb48a1c522c.tar.gz
rpm-d4d4a29f8dd2497607fd375f4966abb48a1c522c.tar.bz2
rpm-d4d4a29f8dd2497607fd375f4966abb48a1c522c.zip
Begin untangling relocation alloca()'s
- allocate rpmRelocation paths on heap, not stack
-rw-r--r--lib/rpmfi.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/rpmfi.c b/lib/rpmfi.c
index 0f3e2cfbf..44aa0710c 100644
--- a/lib/rpmfi.c
+++ b/lib/rpmfi.c
@@ -690,7 +690,7 @@ assert(p != NULL);
/* FIXME: Trailing /'s will confuse us greatly. Internal ones will
too, but those are more trouble to fix up. :-( */
- t = alloca_strdup(p->relocs[i].oldPath);
+ t = xstrdup(p->relocs[i].oldPath);
relocations[i].oldPath = (t[0] == '/' && t[1] == '\0')
? t
: stripTrailingChar(t, '/');
@@ -699,7 +699,7 @@ assert(p != NULL);
if (p->relocs[i].newPath) {
int del;
- t = alloca_strdup(p->relocs[i].newPath);
+ t = xstrdup(p->relocs[i].newPath);
relocations[i].newPath = (t[0] == '/' && t[1] == '\0')
? t
: stripTrailingChar(t, '/');
@@ -1029,6 +1029,10 @@ dColors[j] |= fColors[i];
baseNames = hfd(baseNames, RPM_STRING_ARRAY_TYPE);
dirNames = hfd(dirNames, RPM_STRING_ARRAY_TYPE);
free(fn);
+ for (i = 0; i < numRelocations; i++) {
+ free(relocations[i].oldPath);
+ free(relocations[i].newPath);
+ }
free(relocations);
free(newDirIndexes);
free(dColors);