]> git.sur5r.net Git - openldap/commitdiff
Fix previous commit
authorHoward Chu <hyc@openldap.org>
Thu, 3 Jan 2002 03:44:38 +0000 (03:44 +0000)
committerHoward Chu <hyc@openldap.org>
Thu, 3 Jan 2002 03:44:38 +0000 (03:44 +0000)
libraries/liblber/decode.c

index 6e16c2159eb575c8fd2fda80f13c62a80179939c..acb6effe72db52c08cde46e458a9821415d04daf 100644 (file)
@@ -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;
        }