summaryrefslogtreecommitdiff
path: root/lib/formats.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-04-16 10:10:25 +0300
committerPanu Matilainen <pmatilai@redhat.com>2008-04-16 10:10:25 +0300
commit72b200fe591bf13ecd238c1b3bae785a2907a0fc (patch)
treebd9ada10598aeb494e8af1e4d84a72a3951b60cf /lib/formats.c
parent9ebe81639ab6f5449ad88818fdd111c68245a101 (diff)
downloadrpm-72b200fe591bf13ecd238c1b3bae785a2907a0fc.tar.gz
rpm-72b200fe591bf13ecd238c1b3bae785a2907a0fc.tar.bz2
rpm-72b200fe591bf13ecd238c1b3bae785a2907a0fc.zip
Oops, only free if allocated ;)
Diffstat (limited to 'lib/formats.c')
-rw-r--r--lib/formats.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/formats.c b/lib/formats.c
index a4f8717f4..e056c94f4 100644
--- a/lib/formats.c
+++ b/lib/formats.c
@@ -137,7 +137,7 @@ static char * armorFormat(rpmTagType type, rpm_constdata_t data,
{
const char * enc;
const unsigned char * s;
- unsigned char * bs;
+ unsigned char * bs = NULL;
char *val;
size_t ns;
int atype;
@@ -170,7 +170,9 @@ static char * armorFormat(rpmTagType type, rpm_constdata_t data,
/* XXX this doesn't use padding directly, assumes enough slop in retval. */
val = pgpArmorWrap(atype, s, ns);
- free(bs);
+ if (atype == PGPARMOR_PUBKEY) {
+ free(bs);
+ }
return val;
}