cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Problem with strdup

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Sat, 18 Dec 2004 11:21:41 +0100 (CET)

On Fri, 17 Dec 2004, Eric VERGNAUD wrote:

> Now I have the proof that the comment is write.

I consider this a problem in your end. libcurl is a library written in C and
it uses numerous libc-functions. If your libc provides a flawed version of
strdup(), then I think you should fix your libc.

We could possibly write a configure test that tests your particular strdup()
version to see if it is OK to free() or not, but it sounds like it would be
far from failsafe.

Let me quote from the Linux strdup() man page:

        The strdup() function returns a pointer to a new string which is a
        duplicate of the string s. Memory for the new string is obtained with
        malloc(3), and can be freed with free(3).

-- 
      Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
       Dedicated custom curl help for hire: http://haxx.se/curl.html
Received on 2004-12-18