diff options
author | Yang Tse <yangsita@gmail.com> | 2007-01-31 19:47:49 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2007-01-31 19:47:49 +0000 |
commit | 49c4d9c9cd6ef5354ea68e8ace79fbe3cc5eae9d (patch) | |
tree | e05c4dac0b0b9513411ce06088e5b8eec6e7143a /lib/url.c | |
parent | c2639e07388464dd920fe239358458e42658b278 (diff) |
add debug messages for initialization failures
Diffstat (limited to 'lib/url.c')
-rw-r--r-- | lib/url.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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; |