From: Pierangelo Masarati Date: Fri, 1 Sep 2006 13:59:55 +0000 (+0000) Subject: don't risk dangling pointers X-Git-Tag: OPENLDAP_REL_ENG_2_3_MP~225 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=517ae66152d50f2c1fe3af71adf456e09fc9b3de;p=openldap don't risk dangling pointers --- diff --git a/libraries/libldap/abandon.c b/libraries/libldap/abandon.c index 551940d1b1..c03d9264d6 100644 --- a/libraries/libldap/abandon.c +++ b/libraries/libldap/abandon.c @@ -124,14 +124,22 @@ do_abandon( sendabandon = 1; /* find the request that we are abandoning */ - for ( lr = ld->ld_requests; lr != NULL; lr = lr->lr_next ) { +start_again:; + lr = ld->ld_requests; + while ( lr != NULL ) { if ( lr->lr_msgid == msgid ) { /* this message */ break; } + if ( lr->lr_origid == msgid ) {/* child: abandon it */ - (void) do_abandon( ld, + (void)do_abandon( ld, lr->lr_origid, lr->lr_msgid, sctrls, cctrls ); + + /* restart, as lr may now be dangling... */ + goto start_again; } + + lr = lr->lr_next; } if ( lr != NULL ) {