From: Michael Schroeder Date: Fri, 23 Aug 2013 17:25:41 +0000 (+0200) Subject: create a copy of the sig data so that it can be freed later X-Git-Tag: upstream/0.4.0~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d2a4bc6a851da75c4c6398657b9901dcd4f5379f;p=platform%2Fupstream%2Flibsolv.git create a copy of the sig data so that it can be freed later --- diff --git a/ext/repo_pubkey.c b/ext/repo_pubkey.c index 281feed..3b0e402 100644 --- a/ext/repo_pubkey.c +++ b/ext/repo_pubkey.c @@ -877,7 +877,7 @@ solv_parse_sig(FILE *fp, unsigned char **sigpkgp, int *sigpkglp, char *keyidstr) } } hl = parsepkgheader(sig, sigl, &tag, &pktl); - if (!hl || tag != 2) + if (!hl || tag != 2 || !pktl) { solv_free(sig); return 0; @@ -892,11 +892,11 @@ solv_parse_sig(FILE *fp, unsigned char **sigpkgp, int *sigpkglp, char *keyidstr) } if (sigpkgp) { - *sigpkgp = sig + hl; + *sigpkgp = solv_malloc(pktl); + memcpy(*sigpkgp, sig + hl, pktl); *sigpkglp = pktl; } - else - solv_free(sig); + solv_free(sig); if (keyidstr) solv_bin2hex(pgpsig.issuer, 8, keyidstr); return htype;