Commit 73d0e7fd authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

dnsapi: Fix a number of memory leaks.

parent 97e5728d
......@@ -680,7 +680,7 @@ BOOL WINAPI DnsRecordSetCompare( PDNS_RECORD set1, PDNS_RECORD set2,
DNS_RRSET_ADD( rr1, u );
ret = FALSE;
}
else heap_free( u );
else DnsRecordListFree( u, DnsFreeRecordList );
}
}
......@@ -696,7 +696,7 @@ BOOL WINAPI DnsRecordSetCompare( PDNS_RECORD set1, PDNS_RECORD set2,
DNS_RRSET_ADD( rr2, u );
ret = FALSE;
}
else heap_free( u );
else DnsRecordListFree( u, DnsFreeRecordList );
}
}
......@@ -704,7 +704,10 @@ BOOL WINAPI DnsRecordSetCompare( PDNS_RECORD set1, PDNS_RECORD set2,
DNS_RRSET_TERMINATE( rr2 );
if (diff1) *diff1 = rr1.pFirstRR;
else DnsRecordListFree( rr1.pFirstRR, DnsFreeRecordList );
if (diff2) *diff2 = rr2.pFirstRR;
else DnsRecordListFree( rr2.pFirstRR, DnsFreeRecordList );
return ret;
......
......@@ -89,9 +89,11 @@ static void test_DnsRecordSetCompare( void )
ok( DnsRecordSetCompare( rr1.pFirstRR, NULL, &diff1, &diff2 ) == FALSE, "succeeded unexpectedly\n" );
ok( diff1 != NULL && diff2 == NULL, "unexpected result: %p, %p\n", diff1, diff2 );
DnsRecordListFree( diff1, DnsFreeRecordList );
ok( DnsRecordSetCompare( NULL, rr2.pFirstRR, &diff1, &diff2 ) == FALSE, "succeeded unexpectedly\n" );
ok( diff1 == NULL && diff2 != NULL, "unexpected result: %p, %p\n", diff1, diff2 );
DnsRecordListFree( diff2, DnsFreeRecordList );
ok( DnsRecordSetCompare( rr1.pFirstRR, rr2.pFirstRR, NULL, &diff2 ) == TRUE, "failed unexpectedly\n" );
ok( diff2 == NULL, "unexpected result: %p\n", diff2 );
......@@ -105,8 +107,14 @@ static void test_DnsRecordSetCompare( void )
r2.Data.A.IpAddress = 0;
ok( DnsRecordSetCompare( rr1.pFirstRR, rr2.pFirstRR, NULL, &diff2 ) == FALSE, "succeeded unexpectedly\n" );
DnsRecordListFree( diff2, DnsFreeRecordList );
ok( DnsRecordSetCompare( rr1.pFirstRR, rr2.pFirstRR, &diff1, NULL ) == FALSE, "succeeded unexpectedly\n" );
DnsRecordListFree( diff1, DnsFreeRecordList );
ok( DnsRecordSetCompare( rr1.pFirstRR, rr2.pFirstRR, &diff1, &diff2 ) == FALSE, "succeeded unexpectedly\n" );
DnsRecordListFree( diff1, DnsFreeRecordList );
DnsRecordListFree( diff2, DnsFreeRecordList );
}
static void test_DnsRecordSetDetach( void )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment