Plug a memory leak in armorFormat()
authorPanu Matilainen <pmatilai@redhat.com>
Wed, 16 Apr 2008 07:06:56 +0000 (10:06 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Wed, 16 Apr 2008 07:06:56 +0000 (10:06 +0300)
lib/formats.c

index f728d62..a4f8717 100644 (file)
@@ -138,6 +138,7 @@ static char * armorFormat(rpmTagType type, rpm_constdata_t data,
     const char * enc;
     const unsigned char * s;
     unsigned char * bs;
+    char *val;
     size_t ns;
     int atype;
 
@@ -168,7 +169,9 @@ static char * armorFormat(rpmTagType type, rpm_constdata_t data,
     }
 
     /* XXX this doesn't use padding directly, assumes enough slop in retval. */
-    return pgpArmorWrap(atype, s, ns);
+    val = pgpArmorWrap(atype, s, ns);
+    free(bs);
+    return val;
 }
 
 /**