Browse Source

Bug 697027 - 13 - minor memory leaks found by Valgrind + TET

https://bugzilla.redhat.com/show_bug.cgi?id=697027
[Case 13]
Description: When the log level is set to LDAP_DEBUG_CONNS,
connection_table_dump_activity_to_errors_log could have
accessed the negative-th element of array ct->fd.
Noriko Hosoi 14 years ago
parent
commit
f038ee78a1
1 changed files with 2 additions and 1 deletions
  1. 2 1
      ldap/servers/slapd/conntable.c

+ 2 - 1
ldap/servers/slapd/conntable.c

@@ -484,7 +484,8 @@ connection_table_dump_activity_to_errors_log(Connection_Table *ct)
 			/* Find the connection we are referring to */
 			int j= c->c_fdi;
 			PR_Lock( c->c_mutex );
-			if ( c->c_sd != SLAPD_INVALID_SOCKET && c->c_prfd == ct->fd[j].fd )
+			if ( (c->c_sd != SLAPD_INVALID_SOCKET) && 
+			     (j >= 0) && (c->c_prfd == ct->fd[j].fd) )
 			{
 				int r = ct->fd[j].out_flags & SLAPD_POLL_FLAGS;
 				if ( r )