fix some memory leaks reported by valgrind.

This commit is contained in:
Charles Kerr
2007-10-22 14:15:16 +00:00
parent 50e99456d1
commit e1fbd16941
4 changed files with 5 additions and 3 deletions
+2 -1
View File
@@ -132,11 +132,12 @@ cf_removelocks( void )
gboolean
cf_lock( char ** errstr )
{
const char * path = getLockFilename( );
char * path = getLockFilename( );
int fd = lockfile( path, errstr );
if( fd >= 0 )
gl_lockpath = g_strdup( path );
g_atexit( cf_removelocks );
g_free( path );
return fd >= 0;
}
+1
View File
@@ -818,6 +818,7 @@ dbgmsg( handshake, "reading IA..." );
i = parseHandshake( handshake, inbuf );
dbgmsg( handshake, "parseHandshake returned %d", i );
if( i != HANDSHAKE_OK ) {
evbuffer_free( outbuf );
tr_handshakeDone( handshake, FALSE );
return READ_DONE;
}
+1 -2
View File
@@ -1642,7 +1642,7 @@ tr_peerMsgsNew( struct tr_torrent * torrent,
m->inBlock = evbuffer_new( );
m->peerAllowedPieces = NULL;
m->clientAllowedPieces = NULL;
setme = tr_publisherSubscribe( m->publisher, func, userData );
*setme = tr_publisherSubscribe( m->publisher, func, userData );
if ( tr_peerIoSupportsFEXT( m->io ) )
{
@@ -1744,4 +1744,3 @@ tr_peerMsgIsPieceFastAllowed( const tr_peermsgs * peer,
{
return tr_bitfieldHas( peer->clientAllowedPieces, index );
}
+1
View File
@@ -708,6 +708,7 @@ onTrackerResponse( struct evhttp_request * req, void * torrent_hash )
int responseCode;
t = findTrackerFromHash( torrent_hash );
tr_free( torrent_hash );
if( t == NULL ) /* tracker has been closed */
return;