+Fri Jul 8 17:32:29 1994 Tom Yu (tlyu at dragons-lair)
+
+ * asn1_decode_k.c: yet another instance of the SunOS realloc bug
+
+ * asn1buf.c: whee SunOS realloc of a NULL pointer returns NULL.
+ sigh.
+
Wed Jul 6 13:21:35 1994 Mark Eichin (eichin@cygnus.com)
* an1buf.c: Harry saves vs. Unix again. Making sure that anything
{ sequence_of(&subbuf);
while(asn1buf_remains(&seqbuf)){
size++;
- (*val)->data = (krb5_data*)realloc((*val)->data,
- size*sizeof(krb5_data));
+ if ((*val)->data == NULL)
+ (*val)->data = (krb5_data*)malloc(size*sizeof(krb5_data));
+ else
+ (*val)->data = (krb5_data*)realloc((*val)->data,
+ size*sizeof(krb5_data));
if((*val)->data == NULL) return ENOMEM;
retval = asn1_decode_generalstring(&seqbuf,
&((*val)->data[size-1].length),
#define array_append(array,size,element,type)\
size++;\
-*(array) = (type**)realloc(*(array),\
- (size+1)*sizeof(type*));\
+if (*(array) == NULL)\
+ *(array) = (type**)malloc((size+1)*sizeof(type*));\
+else\
+ *(array) = (type**)realloc(*(array),\
+ (size+1)*sizeof(type*));\
if(*(array) == NULL) return ENOMEM;\
(*(array))[(size)-1] = elt
if(buf->base == NULL) bound_offset = -1;
else bound_offset = buf->bound - buf->base;
-
- buf->base = realloc(buf->base,
- (asn1buf_size(buf)+(inc>STANDARD_INCREMENT ?
- inc : STANDARD_INCREMENT))
- * sizeof(asn1_octet));
+ if (buf->base == NULL)
+ buf->base = malloc((asn1buf_size(buf)+(inc>STANDARD_INCREMENT ?
+ inc : STANDARD_INCREMENT))
+ * sizeof(asn1_octet));
+ else
+ buf->base = realloc(buf->base,
+ (asn1buf_size(buf)+(inc>STANDARD_INCREMENT ?
+ inc : STANDARD_INCREMENT))
+ * sizeof(asn1_octet));
if(buf->base == NULL) return ENOMEM;
buf->bound = (buf->base) + bound_offset + inc;
buf->next = (buf->base) + next_offset;