From f66f9f11cd010a05efe28d0607abbf29ff8dffa5 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Wed, 28 Sep 2011 02:56:36 -0500 Subject: Fix memory leak in download payload->remote_name In the sync code, we explicitly allocated a string for this field, while in the dload code itself it was filled in with a pointer to another string. This led to a memory leak in the sync download case. Make remote_name non-const and always explicitly allocate it. This patch ensures this as well as uses malloc + snprintf (rather than calloc) in several codepaths, and eliminates the only use of PATH_MAX in the download code. 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 bc5eb131..765c5fdf 100644 --- a/lib/libalpm/dload.h +++ b/lib/libalpm/dload.h @@ -27,8 +27,8 @@ struct dload_payload { alpm_handle_t *handle; - const char *remote_name; const char *tempfile_openmode; + char *remote_name; char *tempfile_name; char *destfile_name; char *content_disp_name; -- cgit v1.2.3-24-g4f1b