From 23c620a637f4fbda8148be509728182408865f79 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Sat, 8 Apr 2006 17:34:00 +0000 Subject: [PATCH] don't leak a BerElement --- libraries/liblber/io.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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 * -- 2.39.5