diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2008-04-29 11:53:13 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2008-04-29 11:53:13 +0300 |
commit | 5e775226b6d11fc81022971c06d14ffda3b2e6cb (patch) | |
tree | 6495a1795b0815b5d63a9cb532fba5e60a8e6f37 /lib/signature.c | |
parent | 059719a8fe75ade2d4c12f880cc5d9fb3a1cd140 (diff) | |
download | rpm-5e775226b6d11fc81022971c06d14ffda3b2e6cb.tar.gz rpm-5e775226b6d11fc81022971c06d14ffda3b2e6cb.tar.bz2 rpm-5e775226b6d11fc81022971c06d14ffda3b2e6cb.zip |
Plug memleaks in signature generation
Diffstat (limited to 'lib/signature.c')
-rw-r--r-- | lib/signature.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/signature.c b/lib/signature.c index b1e238fbd..233ef5195 100644 --- a/lib/signature.c +++ b/lib/signature.c @@ -629,7 +629,7 @@ static int makeHDRSignature(Header sigh, const char * file, rpmSigTag sigTag, { Header h = NULL; FD_t fd = NULL; - uint8_t * pkt; + uint8_t * pkt = NULL; size_t pktlen; char * fn = NULL; char * SHA1 = NULL; @@ -728,9 +728,10 @@ static int makeHDRSignature(Header sigh, const char * file, rpmSigTag sigTag, exit: if (fn) { (void) unlink(fn); - fn = _free(fn); + free(fn); } - SHA1 = _free(SHA1); + free(pkt); + free(SHA1); h = headerFree(h); if (fd != NULL) (void) Fclose(fd); return ret; @@ -740,7 +741,7 @@ int rpmAddSignature(Header sigh, const char * file, rpmSigTag sigTag, const char * passPhrase) { struct stat st; - uint8_t * pkt; + uint8_t * pkt = NULL; size_t pktlen; int ret = -1; /* assume failure. */ @@ -792,6 +793,7 @@ int rpmAddSignature(Header sigh, const char * file, rpmSigTag sigTag, case RPMSIGTAG_PAYLOADSIZE: break; } + free(pkt); return ret; } |