mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-04 21:29:21 +00:00
Take ownership of the magnet metadata object
Nothing freed the bencode map the meta download built.
This commit is contained in:
@@ -726,11 +726,10 @@ DownloadList::process_meta_download(Download* download) {
|
||||
return;
|
||||
}
|
||||
|
||||
torrent::Object* bencode = new torrent::Object(torrent::Object::create_map());
|
||||
auto bencode = std::make_unique<torrent::Object>(torrent::Object::create_map());
|
||||
file >> bencode->insert_key("info", torrent::Object());
|
||||
|
||||
if (file.fail()) {
|
||||
delete bencode;
|
||||
lt_log_print(torrent::LOG_TORRENT_ERROR, "Could not create download, the input is not a valid torrent.");
|
||||
return;
|
||||
}
|
||||
@@ -746,7 +745,7 @@ DownloadList::process_meta_download(Download* download) {
|
||||
|
||||
erase_ptr(download);
|
||||
|
||||
control->core()->try_create_download_from_meta_download(bencode, metafile);
|
||||
control->core()->try_create_download_from_meta_download(std::move(bencode), metafile);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -219,7 +219,7 @@ Manager::try_create_download(const std::string& uri, int flags, const command_li
|
||||
}
|
||||
|
||||
void
|
||||
Manager::try_create_download_from_meta_download(torrent::Object* bencode, const std::string& metafile) {
|
||||
Manager::try_create_download_from_meta_download(std::unique_ptr<torrent::Object> bencode, const std::string& metafile) {
|
||||
DownloadFactory* f = new DownloadFactory(this);
|
||||
|
||||
f->variables()["tied_to_file"] = (int64_t)true;
|
||||
|
||||
+1
-1
@@ -76,7 +76,7 @@ public:
|
||||
// Temporary, find a better place for this.
|
||||
void try_create_download(const std::string& uri, int flags, const command_list_type& commands);
|
||||
void try_create_download_expand(const std::string& uri, int flags, command_list_type commands = command_list_type());
|
||||
void try_create_download_from_meta_download(torrent::Object* bencode, const std::string& metafile);
|
||||
void try_create_download_from_meta_download(std::unique_ptr<torrent::Object> bencode, const std::string& metafile);
|
||||
|
||||
private:
|
||||
void create_http(const std::string& uri);
|
||||
|
||||
Reference in New Issue
Block a user