]> git.sur5r.net Git - openldap/commitdiff
cleanup; plug potential leak?
authorPierangelo Masarati <ando@openldap.org>
Wed, 14 Jul 2004 01:10:35 +0000 (01:10 +0000)
committerPierangelo Masarati <ando@openldap.org>
Wed, 14 Jul 2004 01:10:35 +0000 (01:10 +0000)
servers/slapd/result.c

index b7c71a8a9b43477ec5527e869c5081629fbb6f98..4e6cf7a77df8862a9ac7f9d7af1d88ca8741f3a3 100644 (file)
@@ -746,7 +746,7 @@ slap_send_search_entry( Operation *op, SlapReply *rs )
 {
        BerElementBuffer berbuf;
        BerElement      *ber = (BerElement *) &berbuf;
-       Attribute       *a, *aa;
+       Attribute       *a, *aa = NULL;
        int             i, j, rc=-1, bytes;
        char            *edn;
        int             userattrs;
@@ -1196,7 +1196,6 @@ slap_send_search_entry( Operation *op, SlapReply *rs )
                        if ( op->o_res_ber == NULL ) ber_free_buf( ber );
                        send_ldap_error( op, rs, LDAP_OTHER,
                                "encoding description error" );
-                       attrs_free( aa );
                        goto error_return;
                }
 
@@ -1238,7 +1237,6 @@ slap_send_search_entry( Operation *op, SlapReply *rs )
                                        if ( op->o_res_ber == NULL ) ber_free_buf( ber );
                                        send_ldap_error( op, rs, LDAP_OTHER,
                                                "encoding values error" );
-                                       attrs_free( aa );
                                        goto error_return;
                                }
                        }
@@ -1257,7 +1255,6 @@ slap_send_search_entry( Operation *op, SlapReply *rs )
 
                        if ( op->o_res_ber == NULL ) ber_free_buf( ber );
                        send_ldap_error( op, rs, LDAP_OTHER, "encode end error" );
-                       attrs_free( aa );
                        goto error_return;
                }
        }
@@ -1308,7 +1305,6 @@ slap_send_search_entry( Operation *op, SlapReply *rs )
                e_flags = NULL;
        }
 
-       attrs_free( aa );
        rc = ber_printf( ber, /*{{*/ "}N}" );
 
        if( rc != -1 ) {
@@ -1388,6 +1384,10 @@ error_return:;
                slap_sl_free( e_flags, op->o_tmpmemctx );
        }
 
+       if ( aa ) {
+               attrs_free( aa );
+       }
+
        if ( op->o_callback ) {
                slap_callback   *sc = op->o_callback,
                                *sc_next = op->o_callback;