cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: memlimit fail

From: Gisle Vanem <giva_at_bgnett.no>
Date: Sun, 06 Feb 2005 15:57:02 +0100

> I think it looks fine. But you can probably return 'status' if it is non-zero,
> to make it pass-through all errors that might occur and not just the out of
> memory one.

There are problems in ftp.c too. E.g.

set curl_memlimit=59
curl -v ftp://host/misc/file
...
> CWD misc
< 250 CWD command successful.
LIMIT hash.c:127 strdup reached memlimit
* Could not resolve host: host; No error
* Closing connection #0
* No error

Then it crashes in freedirs():
curl.exe caused an Access Violation at location 10008d88 in module libcurl.dll Reading
from location 13131313.

Registers:
eax=13131313 ebx=00000000 ecx=77c3177c edx=13131313 esi=00d15d98 edi=00000000
eip=10008d88 esp=0022eaf0 ebp=0022eaf8 iopl=0 nv up ei pl nz na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00200202

Call stack:
10008D88 libcurl.dll:10008D88 freedirs ftp.c:138
static void freedirs(
        struct FTP * ftp =
)
        ...
          if(ftp->dirs) {
            for (i=0; i < ftp->dirdepth; i++){
> if(ftp->dirs[i]) {
                free(ftp->dirs[i]);
                ftp->dirs[i]=NULL;
        ...

1000B261 libcurl.dll:1000B261 Curl_ftp ftp.c:2934
CURLcode Curl_ftp(
        struct connectdata * conn = &(indirect)
)
        ...
          }
          else
> freedirs(ftp);

          ftp->ctl_valid = TRUE; /* seems good */
        ...

Looks like a case of double freeing. If I remove the above freedirs(), it
crashes inside hostip.c. Will dig some more.

--gv
Received on 2005-02-06