Avoid alloca() in legacyRetrofit()
authorPanu Matilainen <pmatilai@redhat.com>
Tue, 29 Apr 2008 07:40:56 +0000 (10:40 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Tue, 29 Apr 2008 07:40:56 +0000 (10:40 +0300)
lib/legacy.c

index 3e6d4d1..ae6d7e0 100644 (file)
@@ -234,9 +234,10 @@ void legacyRetrofit(Header h)
      */
     if (headerGetEntry(h, RPMTAG_DEFAULTPREFIX, NULL, (rpm_data_t *) &prefix, NULL))
     {
-       const char * nprefix = stripTrailingChar(alloca_strdup(prefix), '/');
+       char * nprefix = stripTrailingChar(xstrdup(prefix), '/');
        (void) headerAddEntry(h, RPMTAG_PREFIXES, RPM_STRING_ARRAY_TYPE,
                &nprefix, 1); 
+       free(nprefix);
     }
 
     /*