Skip to content
Permalink
Browse files

curl: fix memory leaked by parse_metalink()

This commit fixes a regression introduced by curl-7_65_3-5-gb88940850.
Detected by tests 2005, 2008, 2009, 2010, 2011, and 2012 with valgrind
and libmetalink enabled.
  • Loading branch information...
kdudka committed Sep 11, 2019
1 parent a765a30 commit 40e1b15bdd9ef4b8d5569b7ebebac20a3427cf17
Showing with 7 additions and 1 deletion.
  1. +1 −1 src/tool_metalink.c
  2. +2 −0 src/tool_metalink.h
  3. +4 −0 src/tool_operate.c
@@ -965,7 +965,7 @@ static void delete_metalink_resource(metalink_resource *res)
Curl_safefree(res);
}

static void delete_metalinkfile(metalinkfile *mlfile)
void delete_metalinkfile(metalinkfile *mlfile)
{
metalink_resource *res;
if(mlfile == NULL) {
@@ -105,6 +105,8 @@ extern const digest_params SHA256_DIGEST_PARAMS[1];
* Counts the resource in the metalinkfile.
*/
int count_next_metalink_resource(metalinkfile *mlfile);

void delete_metalinkfile(metalinkfile *mlfile);
void clean_metalink(struct OperationConfig *config);

/*
@@ -2073,6 +2073,10 @@ static CURLcode serial_transfers(struct GlobalConfig *global,
result = post_transfer(global, share, per, result, &retry);
if(retry)
continue;

/* Release metalink related resources here */
delete_metalinkfile(per->mlfile);

per = del_transfer(per);

/* Bail out upon critical errors or --fail-early */

0 comments on commit 40e1b15

Please sign in to comment.
You can’t perform that action at this time.