diff options
| author | Yang Tse <yangsita@gmail.com> | 2007-04-08 22:49:38 +0000 | 
|---|---|---|
| committer | Yang Tse <yangsita@gmail.com> | 2007-04-08 22:49:38 +0000 | 
| commit | 0e05a6329a885a513aefa6c3e698f4cb1f08eb73 (patch) | |
| tree | 21e9015ae3aca36b6d618a30390e4b601a0bdd93 /lib | |
| parent | c518c52aba002a0f17651178814bac494f62ab59 (diff) | |
fix out of memory handling issue
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/easy.c | 5 | ||||
| -rw-r--r-- | lib/url.c | 10 | 
2 files changed, 12 insertions, 3 deletions
| diff --git a/lib/easy.c b/lib/easy.c index 6195d21e3..939966dde 100644 --- a/lib/easy.c +++ b/lib/easy.c @@ -397,7 +397,10 @@ CURLcode curl_easy_perform(CURL *easy)    mcode = curl_multi_add_handle(multi, easy);    if(mcode) {      curl_multi_cleanup(multi); -    return CURLE_FAILED_INIT; +    if(mcode == CURLM_OUT_OF_MEMORY) +      return CURLE_OUT_OF_MEMORY; +    else +      return CURLE_FAILED_INIT;    }    /* we start some action by calling perform right away */ @@ -501,6 +501,9 @@ CURLcode Curl_open(struct SessionHandle **curl)  {    CURLcode res = CURLE_OK;    struct SessionHandle *data; +#ifdef USE_ARES +  int status; +#endif    /* Very simple start-up: alloc the struct, init it with zeroes and return */    data = (struct SessionHandle *)calloc(1, sizeof(struct SessionHandle)); @@ -513,10 +516,13 @@ CURLcode Curl_open(struct SessionHandle **curl)    data->magic = CURLEASY_MAGIC_NUMBER;  #ifdef USE_ARES -  if(ARES_SUCCESS != ares_init(&data->state.areschannel)) { +  if ((status = ares_init(&data->state.areschannel)) != ARES_SUCCESS) {      DEBUGF(fprintf(stderr, "Error: ares_init failed\n"));      free(data); -    return CURLE_FAILED_INIT; +    if (status == ARES_ENOMEM) +      return CURLE_OUT_OF_MEMORY; +    else +      return CURLE_FAILED_INIT;    }    /* make sure that all other returns from this function should destroy the       ares channel before returning error! */ | 
