*
* HTTP routines for the Common UNIX Printing System (CUPS).
*
- * Copyright 2007 by Apple Inc.
+ * Copyright 2007-2008 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* This file contains Kerberos support code, copyright 2006 by
* Allocate memory for the structure...
*/
- http = calloc(sizeof(http_t), 1);
- if (http == NULL)
+ if ((http = calloc(sizeof(http_t), 1)) == NULL)
+ {
+ httpAddrFreeList(addrlist);
return (NULL);
+ }
http->version = HTTP_1_1;
http->blocking = 1;
*/
int len = (int)strlen(scheme) + (data ? (int)strlen(data) + 1 : 0) + 1;
+ char *temp;
if (len > (int)sizeof(http->_authstring))
- http->authstring = malloc(len);
+ {
+ if ((temp = malloc(len)) == NULL)
+ len = sizeof(http->_authstring);
+ else
+ http->authstring = temp;
+ }
if (data)
snprintf(http->authstring, len, "%s %s", scheme, data);