mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-22 00:56:18 +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;
|
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());
|
file >> bencode->insert_key("info", torrent::Object());
|
||||||
|
|
||||||
if (file.fail()) {
|
if (file.fail()) {
|
||||||
delete bencode;
|
|
||||||
lt_log_print(torrent::LOG_TORRENT_ERROR, "Could not create download, the input is not a valid torrent.");
|
lt_log_print(torrent::LOG_TORRENT_ERROR, "Could not create download, the input is not a valid torrent.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -746,7 +745,7 @@ DownloadList::process_meta_download(Download* download) {
|
|||||||
|
|
||||||
erase_ptr(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
|
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);
|
DownloadFactory* f = new DownloadFactory(this);
|
||||||
|
|
||||||
f->variables()["tied_to_file"] = (int64_t)true;
|
f->variables()["tied_to_file"] = (int64_t)true;
|
||||||
|
|||||||
+1
-1
@@ -76,7 +76,7 @@ public:
|
|||||||
// Temporary, find a better place for this.
|
// 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(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_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:
|
private:
|
||||||
void create_http(const std::string& uri);
|
void create_http(const std::string& uri);
|
||||||
|
|||||||
Reference in New Issue
Block a user