xbps-rindex: [sign] pubkey buffer must be kept until index-meta is externalized too.

This commit is contained in:
Juan RP 2014-02-06 12:26:17 +01:00
parent 11e04685ef
commit cbe05bd0f4

View File

@ -128,7 +128,7 @@ sign_repo(struct xbps_handle *xhp, const char *repodir,
unsigned int siglen;
uint16_t rpubkeysize, pubkeysize;
const char *arch, *pkgver, *rsignedby = NULL;
char *binpkg, *binpkg_sig, *buf, *defprivkey;
char *binpkg, *binpkg_sig, *buf = NULL, *defprivkey;
int binpkg_fd, binpkg_sig_fd, rv = 0;
bool flush = false;
@ -265,7 +265,6 @@ sign_repo(struct xbps_handle *xhp, const char *repodir,
if (!xbps_data_equals(rpubkey, data))
flush = true;
free(buf);
pubkeysize = RSA_size(rsa) * 8;
xbps_dictionary_get_uint16(repo->idxmeta, "public-key-size", &rpubkeysize);
@ -298,6 +297,8 @@ sign_repo(struct xbps_handle *xhp, const char *repodir,
out:
index_unlock(il);
if (buf)
free(buf);
if (data)
xbps_object_release(data);
if (rsa) {