]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/http.c
Import CUPS 1.4svn-r7226.
[thirdparty/cups.git] / cups / http.c
index 9efa1a365d7140c982e6b35bbcff4b7343cdba2b..f860a221d006c04811b58f39da2274ea1c32cd5b 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   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
@@ -402,9 +402,11 @@ httpConnectEncrypt(
   * 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;
@@ -1735,9 +1737,15 @@ httpSetAuthString(http_t     *http,      /* I - HTTP connection */
     */
 
     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);