From 49c4d9c9cd6ef5354ea68e8ace79fbe3cc5eae9d Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Wed, 31 Jan 2007 19:47:49 +0000 Subject: add debug messages for initialization failures --- lib/url.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib/url.c') diff --git a/lib/url.c b/lib/url.c index bc896b39d..63c93f1b1 100644 --- a/lib/url.c +++ b/lib/url.c @@ -485,14 +485,17 @@ CURLcode Curl_open(struct SessionHandle **curl) /* Very simple start-up: alloc the struct, init it with zeroes and return */ data = (struct SessionHandle *)calloc(1, sizeof(struct SessionHandle)); - if(!data) + if(!data) { /* this is a very serious error */ + DEBUGF(fprintf(stderr, "Error: calloc of SessionHandle failed\n")); return CURLE_OUT_OF_MEMORY; + } data->magic = CURLEASY_MAGIC_NUMBER; #ifdef USE_ARES if(ARES_SUCCESS != ares_init(&data->state.areschannel)) { + DEBUGF(fprintf(stderr, "Error: ares_init failed\n")); free(data); return CURLE_FAILED_INIT; } @@ -503,8 +506,10 @@ CURLcode Curl_open(struct SessionHandle **curl) /* We do some initial setup here, all those fields that can't be just 0 */ data->state.headerbuff=(char*)malloc(HEADERSIZE); - if(!data->state.headerbuff) + if(!data->state.headerbuff) { + DEBUGF(fprintf(stderr, "Error: malloc of headerbuff failed\n")); res = CURLE_OUT_OF_MEMORY; + } else { data->state.headersize=HEADERSIZE; -- cgit v1.2.3