From 61aa7bef74a4bbb2086d4ed99b662e481afba011 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 3 Jan 2002 03:44:38 +0000 Subject: [PATCH] Fix previous commit --- libraries/liblber/decode.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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; } -- 2.39.5