that can call calloc with a zero argument won't return ENOMEM if
calloc retuns NULL in this case. This was prompted by breakage
under linux.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@3956
dc483132-0cff-0310-8789-
dd5450dbe970
Wed Jul 6 13:21:35 1994 Mark Eichin (eichin@cygnus.com)
+ * an1buf.c: Harry saves vs. Unix again. Making sure that anything
+ that can call calloc with a zero argument won't return ENOMEM if
+ calloc retuns NULL in this case. This was prompted by breakage
+ under linux.
+
* asn1_encode.c (asn1_encode_generaltime): don't use strftime on
the output of gmtime -- under Solaris, it mutates it! (seems to be
doing a timezone offset.) Besides, sprintf is quite sufficient.
if(buf->next + len - 1 > buf->bound) return ASN1_OVERRUN;
*s = (asn1_octet*)calloc(len,sizeof(asn1_octet));
- if(*s == NULL) return ENOMEM;
+ if((*s == NULL) && len) return ENOMEM;
for(i=0; i<len; i++)
(*s)[i] = (asn1_octet)(buf->next)[i];
buf->next += len;
if(buf->next + len - 1 > buf->bound) return ASN1_OVERRUN;
*s = (char*)calloc(len,sizeof(char));
- if(*s == NULL) return ENOMEM;
+ if((*s == NULL) && len) return ENOMEM;
for(i=0; i<len; i++)
(*s)[i] = (char)(buf->next)[i];
buf->next += len;