From: Pierangelo Masarati Date: Sat, 8 Apr 2006 17:34:00 +0000 (+0000) Subject: don't leak a BerElement X-Git-Tag: OPENLDAP_REL_ENG_2_4_0ALPHA~10^2~4 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=23c620a637f4fbda8148be509728182408865f79;p=openldap don't leak a BerElement --- diff --git a/libraries/liblber/io.c b/libraries/liblber/io.c index 934d488b7d..1c162ecebc 100644 --- a/libraries/liblber/io.c +++ b/libraries/liblber/io.c @@ -202,7 +202,8 @@ int ber_flush( Sockbuf *sb, BerElement *ber, int freeit ) { ber_len_t towrite; - ber_slen_t rc; + ber_slen_t rc; + int retcode = 0; assert( sb != NULL ); assert( ber != NULL ); @@ -231,16 +232,18 @@ ber_flush( Sockbuf *sb, BerElement *ber, int freeit ) #else rc = ber_int_sb_write( sb, ber->ber_rwptr, towrite ); #endif - if (rc<=0) { - return -1; + if ( rc <= 0 ) { + retcode = -1; + goto done; } towrite -= rc; ber->ber_rwptr += rc; } +done:; if ( freeit ) ber_free( ber, 1 ); - return( 0 ); + return retcode; } BerElement *