From: Howard Chu Date: Thu, 3 Jan 2002 03:44:38 +0000 (+0000) Subject: Fix previous commit X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~326 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=61aa7bef74a4bbb2086d4ed99b662e481afba011;p=openldap Fix previous commit --- diff --git a/libraries/liblber/decode.c b/libraries/liblber/decode.c index 6e16c2159e..acb6effe72 100644 --- a/libraries/liblber/decode.c +++ b/libraries/liblber/decode.c @@ -322,20 +322,23 @@ ber_get_stringbvr( bgbvr *b, int n ) switch (b->choice) { case ChArray: *b->res.c = LBER_MALLOC( (n+1) * sizeof( char * )); + if ( *b->res.c == NULL ) + return LBER_DEFAULT; (*b->res.c)[n] = NULL; break; case BvArray: *b->res.ba = LBER_MALLOC( (n+1) * sizeof( struct berval )); + if ( *b->res.ba == NULL ) + return LBER_DEFAULT; (*b->res.ba)[n].bv_val = NULL; break; case BvVec: *b->res.bv = LBER_MALLOC( (n+1) * sizeof( struct berval *)); + if ( *b->res.bv == NULL ) + return LBER_DEFAULT; (*b->res.bv)[n] = NULL; break; } - /* Did the malloc succeed? */ - if ( *b->res.c == NULL ) - return LBER_DEFAULT; return 0; }