(trunk libT) remove a small memory leak in the request-list unit test s.t. valgrind will be happy

This commit is contained in:
Charles Kerr 2009-01-04 17:46:27 +00:00
parent ca6dd89e10
commit 6681107c00
2 changed files with 6 additions and 5 deletions

View File

@ -105,6 +105,7 @@ testFoo( void )
check( !reqListHas( &list, &b ) );
check( !reqListHas( &list, &c ) );
reqListClear( &list );
return 0;
}

View File

@ -16,11 +16,9 @@
#include "utils.h"
static int
compareRequests( const void * va, const void * vb )
compareRequests( const struct peer_request * a,
const struct peer_request * b )
{
const struct peer_request * a = va;
const struct peer_request * b = vb;
if( a->index != b->index )
return a->index < b->index ? -1 : 1;
@ -62,6 +60,8 @@ reqListCopy( struct request_list * dest, const struct request_list * src )
dest->sort = tr_memdup( src->sort, dest->len * sizeof( struct peer_request ) );
}
typedef int (*compareFunc)(const void * a, const void * b );
static int
reqListSortPos( const struct request_list * list,
const struct peer_request * req,
@ -71,7 +71,7 @@ reqListSortPos( const struct request_list * list,
list->sort,
list->len,
sizeof( struct peer_request ),
compareRequests,
(compareFunc)compareRequests,
exactMatch );
}