From e0acf2f144404e613a75d5aafea2a909989544e9 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Wed, 28 Sep 2011 12:58:43 -0500 Subject: Refactor download payload reset and free This was done to squash a memory leak in the sync database download code. When we downloaded a database and then reused the payload struct, we could find ourselves calling get_fullpath() for the signatures and overwriting non-freed values we had left over from the database download. Refactor the payload_free function into a payload_reset function that we can call that does NOT free the payload itself, so we can reuse payload structs. This also allows us to move the payload to the stack in some call paths, relieving us of the need to alloc space. Signed-off-by: Dan McGee --- lib/libalpm/dload.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/libalpm/dload.h') diff --git a/lib/libalpm/dload.h b/lib/libalpm/dload.h index c2fd6095..9be29bc8 100644 --- a/lib/libalpm/dload.h +++ b/lib/libalpm/dload.h @@ -42,7 +42,7 @@ struct dload_payload { CURLcode curlerr; /* last error produced by curl */ }; -void _alpm_dload_payload_free(struct dload_payload *payload); +void _alpm_dload_payload_reset(struct dload_payload *payload); int _alpm_download(struct dload_payload *payload, const char *localpath, char **final_file); -- cgit v1.2.3-24-g4f1b