#include "cache.h"
+#include "config.h"
#include "run-command.h"
#include "strbuf.h"
#include "gpg-interface.h"
void signature_check_clear(struct signature_check *sigc)
{
- free(sigc->payload);
- free(sigc->gpg_output);
- free(sigc->gpg_status);
- free(sigc->signer);
- free(sigc->key);
- sigc->payload = NULL;
- sigc->gpg_output = NULL;
- sigc->gpg_status = NULL;
- sigc->signer = NULL;
- sigc->key = NULL;
+ FREE_AND_NULL(sigc->payload);
+ FREE_AND_NULL(sigc->gpg_output);
+ FREE_AND_NULL(sigc->gpg_status);
+ FREE_AND_NULL(sigc->signer);
+ FREE_AND_NULL(sigc->key);
}
static struct {
fd = mks_tempfile_t(&temp, ".git_vtag_tmpXXXXXX");
if (fd < 0)
return error_errno(_("could not create temporary file"));
- if (write_in_full(fd, signature, signature_size) < 0) {
+ if (write_in_full(fd, signature, signature_size) < 0 ||
+ close_tempfile_gently(&temp) < 0) {
error_errno(_("failed writing detached signature to '%s'"),
temp.filename.buf);
delete_tempfile(&temp);
return -1;
}
- close(fd);
argv_array_pushl(&gpg.args,
gpg_program,