create_tempfile: fix memory leak on error

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Allan McRae 2014-12-24 10:37:28 +10:00
parent 123ecb8e07
commit 52d2ff648d

View file

@ -379,7 +379,7 @@ static FILE *create_tempfile(struct dload_payload *payload, const char *localpat
payload->tempfile_name = randpath;
free(payload->remote_name);
STRDUP(payload->remote_name, strrchr(randpath, '/') + 1,
RET_ERR(payload->handle, ALPM_ERR_MEMORY, NULL));
fclose(fp); RET_ERR(payload->handle, ALPM_ERR_MEMORY, NULL));
return fp;
}