changeset 9818:5206fb21e358

[gaim-migrate @ 10689] Thanks, Stu committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 22 Aug 2004 16:16:46 +0000
parents 5afa28c94201
children 34b468bdc1c5
files src/util.c
diffstat 1 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/util.c	Sun Aug 22 15:40:19 2004 +0000
+++ b/src/util.c	Sun Aug 22 16:16:46 2004 +0000
@@ -2616,8 +2616,8 @@
 	 * if we make sure that there is indeed a \n in our header.
 	 */
 	if (p && g_strstr_len(p, data_len - (p - data), "\n")) {
-		sscanf(p, "Content-Length: %ud", &content_len);
-		gaim_debug_misc("parse_content_len", "parsed %d\n", content_len);
+		sscanf(p, "Content-Length: %u", &content_len);
+		gaim_debug_misc("parse_content_len", "parsed %u\n", content_len);
 	}
 
 	return content_len;
@@ -2741,7 +2741,14 @@
 
 					/* In with the new. */
 					gfud->data_len = content_len;
-					gfud->webdata = g_malloc(gfud->data_len);
+					gfud->webdata = g_try_malloc(gfud->data_len);
+					if (gfud->webdata == NULL) {
+						gaim_debug_error("gaim_url_fetch", "Failed to allocate %u bytes: %s\n", gfud->data_len, strerror(errno));
+						gaim_input_remove(gfud->inpa);
+						close(sock);
+						gfud->callback(gfud->user_data, NULL, 0);
+						destroy_fetch_url_data(gfud);
+					}
 				}
 				else
 					gfud->newline = TRUE;