1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-02-22 22:20:39 +00:00

fix: recent regressions (#1873)

* fixup! refactor: use std::set in tr_webseed (#1847)

fix: use placement new to instantiate tr_webseeds.tasks

* fixup! refactor: use std::string in tr_scrape_response (#1866)

fix: avoid assigning a nullptr to std::string

* fixup! refactor: use std::string in tr_scrape_response (#1866)

fix: avoid assigning a nullptr to std::string
This commit is contained in:
Charles Kerr 2021-10-01 16:57:30 -05:00 committed by GitHub
parent 916d418824
commit 6b71050000
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 2 deletions

View file

@ -229,7 +229,7 @@ static void tau_scrape_request_fail(struct tau_scrape_request* request, bool did
{ {
request->response.did_connect = did_connect; request->response.did_connect = did_connect;
request->response.did_timeout = did_timeout; request->response.did_timeout = did_timeout;
request->response.errmsg = errmsg; request->response.errmsg = errmsg == nullptr ? "" : errmsg;
tau_scrape_request_finished(request); tau_scrape_request_finished(request);
} }

View file

@ -246,7 +246,7 @@ static void trackerConstruct(tr_announcer* announcer, tr_tracker* tracker, tr_tr
memset(tracker, 0, sizeof(tr_tracker)); memset(tracker, 0, sizeof(tr_tracker));
tracker->key = getKey(inf->announce); tracker->key = getKey(inf->announce);
tracker->announce = tr_strdup(inf->announce); tracker->announce = tr_strdup(inf->announce);
tracker->scrape_info = tr_announcerGetScrapeInfo(announcer, inf->scrape); tracker->scrape_info = inf->scrape == nullptr ? nullptr : tr_announcerGetScrapeInfo(announcer, inf->scrape);
tracker->id = inf->id; tracker->id = inf->id;
tracker->seederCount = -1; tracker->seederCount = -1;
tracker->leecherCount = -1; tracker->leecherCount = -1;

View file

@ -605,6 +605,8 @@ tr_webseed* tr_webseedNew(struct tr_torrent* tor, char const* url, tr_peer_callb
tr_bitfieldSetHasAll(&peer->have); tr_bitfieldSetHasAll(&peer->have);
tr_peerUpdateProgress(tor, peer); tr_peerUpdateProgress(tor, peer);
using type = decltype(w->tasks);
new (&w->tasks) type;
w->torrent_id = tr_torrentId(tor); w->torrent_id = tr_torrentId(tor);
w->session = tor->session; w->session = tor->session;
w->base_url_len = strlen(url); w->base_url_len = strlen(url);