xbps-rindex/sign: fix a memleak found by clang-analyzer.

This commit is contained in:
Juan RP 2015-12-21 17:16:00 +01:00
parent 9e524d831c
commit 83b5b357cb

View File

@ -304,13 +304,16 @@ sign_pkg(struct xbps_handle *xhp, const char *binpkg, const char *privkey, bool
if (sigfile_fd == -1) {
fprintf(stderr, "failed to create %s: %s\n", sigfile, strerror(errno));
rv = EINVAL;
free(sig);
goto out;
}
if (write(sigfile_fd, sig, siglen) != (ssize_t)siglen) {
fprintf(stderr, "failed to write %s: %s\n", sigfile, strerror(errno));
rv = EINVAL;
free(sig);
goto out;
}
free(sig);
printf("signed successfully %s\n", binpkg);
out: