1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 09:37:56 +00:00

better fix for the leak in r2870

This commit is contained in:
Charles Kerr 2007-08-19 04:03:06 +00:00
parent e19ecccae8
commit 4e82903313

View file

@ -405,7 +405,7 @@ tr_torrentParse( const tr_handle_t * h,
const char * destination,
tr_info_t * setme_info )
{
int ret;
int ret, doFree;
tr_info_t tmp;
if( setme_info == NULL )
@ -413,11 +413,12 @@ tr_torrentParse( const tr_handle_t * h,
memset( setme_info, 0, sizeof( tr_info_t ) );
ret = tr_metainfoParseFile( setme_info, h->tag, path, FALSE );
doFree = !ret && (setme_info == &tmp);
if( ret == TR_OK )
ret = infoCanAdd( h, destination, setme_info );
if( setme_info == &tmp )
if( doFree )
tr_metainfoFree( &tmp );
return ret;
@ -455,7 +456,7 @@ tr_torrentParseHash( const tr_handle_t * h,
const char * destination,
tr_info_t * setme_info )
{
int ret;
int ret, doFree;
tr_info_t tmp;
if( setme_info == NULL )
@ -463,11 +464,12 @@ tr_torrentParseHash( const tr_handle_t * h,
memset( setme_info, 0, sizeof( tr_info_t ) );
ret = tr_metainfoParseHash( setme_info, h->tag, hashStr );
doFree = !ret && (setme_info == &tmp);
if( ret == TR_OK )
ret = infoCanAdd( h, destination, setme_info );
if( setme_info == &tmp )
if( doFree )
tr_metainfoFree( &tmp );
return ret;
@ -506,7 +508,7 @@ tr_torrentParseData( const tr_handle_t * h,
const char * destination,
tr_info_t * setme_info )
{
int ret;
int ret, doFree;
tr_info_t tmp;
if( setme_info == NULL )
@ -514,11 +516,12 @@ tr_torrentParseData( const tr_handle_t * h,
memset( setme_info, 0, sizeof( tr_info_t ) );
ret = tr_metainfoParseData( setme_info, h->tag, data, size, FALSE );
doFree = !ret && (setme_info == &tmp);
if( ret == TR_OK )
ret = infoCanAdd( h, destination, setme_info );
if( setme_info == &tmp )
if( doFree )
tr_metainfoFree( &tmp );
return ret;