(trunk, libT) #5081 'Transmission discards webseed URLs that have trailing whitespace' -- fixed. Unit test passes and valgrind says 'All heap blocks were freed -- no leaks are possible'
This commit is contained in:
parent
0630583637
commit
031e313aa2
|
@ -1,7 +1,7 @@
|
||||||
#include "transmission.h"
|
#include "transmission.h"
|
||||||
#include "utils.h" /* tr_strcmp0 */
|
#include "utils.h" /* tr_strcmp0 */
|
||||||
|
|
||||||
#define VERBOSE
|
#undef VERBOSE
|
||||||
#include "libtransmission-test.h"
|
#include "libtransmission-test.h"
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
@ -371,10 +371,15 @@ getannounce( tr_info * inf, tr_benc * meta )
|
||||||
* trailing slash for multifile torrents if omitted by the end user.
|
* trailing slash for multifile torrents if omitted by the end user.
|
||||||
*/
|
*/
|
||||||
static char*
|
static char*
|
||||||
fix_webseed_url( const tr_info * inf, const char * url )
|
fix_webseed_url( const tr_info * inf, const char * url_in )
|
||||||
{
|
{
|
||||||
|
size_t len;
|
||||||
|
char * url;
|
||||||
char * ret = NULL;
|
char * ret = NULL;
|
||||||
const size_t len = strlen( url );
|
|
||||||
|
url = tr_strdup( url_in );
|
||||||
|
tr_strstrip( url );
|
||||||
|
len = strlen( url );
|
||||||
|
|
||||||
if( tr_urlIsValid( url, len ) )
|
if( tr_urlIsValid( url, len ) )
|
||||||
{
|
{
|
||||||
|
@ -384,6 +389,7 @@ fix_webseed_url( const tr_info * inf, const char * url )
|
||||||
ret = tr_strndup( url, len );
|
ret = tr_strndup( url, len );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tr_free( url );
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue