mirror of
https://github.com/transmission/transmission
synced 2024-12-24 00:34:04 +00:00
* fix memory leak when adding torrents.
* zero out tr_torrentParse()'s tr_info_t before filling it
This commit is contained in:
parent
ae40410b4e
commit
8aa002b25e
1 changed files with 12 additions and 0 deletions
|
@ -287,11 +287,15 @@ tr_torrentParse( const tr_handle_t * h,
|
|||
if( setme_info == NULL )
|
||||
setme_info = &tmp;
|
||||
|
||||
memset( setme_info, 0, sizeof( tr_info_t ) );
|
||||
ret = tr_metainfoParseFile( setme_info, h->tag, path, FALSE );
|
||||
|
||||
if( ret == TR_OK )
|
||||
ret = infoCanAdd( h, destination, setme_info );
|
||||
|
||||
if( setme_info == &tmp )
|
||||
tr_metainfoFree( &tmp );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -329,11 +333,15 @@ tr_torrentParseHash( const tr_handle_t * h,
|
|||
if( setme_info == NULL )
|
||||
setme_info = &tmp;
|
||||
|
||||
memset( setme_info, 0, sizeof( tr_info_t ) );
|
||||
ret = tr_metainfoParseHash( setme_info, h->tag, hashStr );
|
||||
|
||||
if( ret == TR_OK )
|
||||
ret = infoCanAdd( h, destination, setme_info );
|
||||
|
||||
if( setme_info == &tmp )
|
||||
tr_metainfoFree( &tmp );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -373,11 +381,15 @@ tr_torrentParseData( const tr_handle_t * h,
|
|||
if( setme_info == NULL )
|
||||
setme_info = &tmp;
|
||||
|
||||
memset( setme_info, 0, sizeof( tr_info_t ) );
|
||||
ret = tr_metainfoParseData( setme_info, h->tag, data, size, FALSE );
|
||||
|
||||
if( ret == TR_OK )
|
||||
ret = infoCanAdd( h, destination, setme_info );
|
||||
|
||||
if( setme_info == &tmp )
|
||||
tr_metainfoFree( &tmp );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue