downloadsmenu.cpp: Fix a couple of memory leaks

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9530 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 201ea18b8162c42baf82389f3128606055aa4c74
Former-commit-id: cd8d9bea7ec9ef4fa426e9b64dbbf03db4b0e04a
This commit is contained in:
xavi92 2024-08-08 23:23:42 +00:00
parent c43b0f8db7
commit 765250191a

View file

@ -824,13 +824,14 @@ int DownloadsMenu::fetch_thumbnails(const std::vector<Asset> &assets)
static const size_t max = 1 * MB;
writefile *w = new writefile(path.c_str(), max);
entries.push_back(new entry(a, path));
if (add(a.thumbnail.c_str(), &DownloadsMenu::thumbnail_fetched, w, max))
{
GfLogError("add failed\n");
delete w;
return -1;
}
entries.push_back(new entry(a, path));
}
return 0;
@ -969,6 +970,7 @@ void DownloadsMenu::pressed(thumbnail *t)
if (add(a.url.c_str(), &DownloadsMenu::asset_fetched, w, a.size))
{
GfLogError("add failed\n");
delete w;
return;
}