]> git.sur5r.net Git - openldap/commitdiff
ITS#7588 plug memleak
authorHoward Chu <hyc@openldap.org>
Mon, 27 May 2013 18:17:05 +0000 (11:17 -0700)
committerHoward Chu <hyc@openldap.org>
Mon, 27 May 2013 18:17:05 +0000 (11:17 -0700)
servers/slapd/overlays/sssvlv.c

index 49b4cf01b066072ff3dd7aab5ed7d754220a5e12..c6779dd3a7a9129df6024c02f86791a1f4849e1c 100644 (file)
@@ -397,7 +397,19 @@ static void free_sort_op( Connection *conn, sort_op *so )
 {
        int sess_id;
        if ( so->so_tree ) {
-               tavl_free( so->so_tree, ch_free );
+               if ( so->so_paged > SLAP_CONTROL_IGNORED ) {
+                       Avlnode *cur_node, *next_node;
+                       cur_node = so->so_tree;
+                       while ( cur_node ) {
+                               next_node = tavl_next( cur_node, TAVL_DIR_RIGHT );
+                               ch_free( cur_node->avl_data );
+                               ber_memfree( cur_node );
+
+                               cur_node = next_node;
+                       }
+               } else {
+                       tavl_free( so->so_tree, ch_free );
+               }
                so->so_tree = NULL;
        }