#831 cookie.c may leak memory

closed-fixed
libcurl (356)
5
2014-08-26
2009-05-25
T. Manske
No

version 7.19.5, 7.19.4

Valgrind hinted me to memory leaks in lib/cookie.c with my application.
The appended patch stuffed them for me.

Discussion

  • T. Manske

    T. Manske - 2009-05-25

    Patch for lib/cookie.c

     
    Attachments
  • Daniel Stenberg

    Daniel Stenberg - 2009-05-25

    oh, do you by any chance receive cookies with multiple domain and path properties? Or how did you end up with a leak for these?

     
  • Daniel Stenberg

    Daniel Stenberg - 2009-05-25

    cookie leak fix with strstore()

     
    Attachments
  • Daniel Stenberg

    Daniel Stenberg - 2009-05-25

    Assuming that was the case, can you give me your opinion on my suggested fix for this as I just attached here?

     
  • T. Manske

    T. Manske - 2009-05-25

    Well, the cookies are set manually so they may not be well formed. Ii.e. they come from javascript, not http, so they may not be well formed. My application just passes them to libcurl without validation. Indeed there are sometimes doubled path and/or domain parts in them.

     
  • T. Manske

    T. Manske - 2009-05-25

    Thanks, this helps as well.
    I suggest changing the type of the second argument of strstore() to const char * to get rid of those compiler warnings.

     
  • Daniel Stenberg

    Daniel Stenberg - 2009-05-25

    Thanks, I did that and committed this fix just now. If you tell me your full name I'll give you the proper credit for this find in the changelog etc.

     
  • Daniel Stenberg

    Daniel Stenberg - 2009-05-25
    • status: open --> open-fixed
     
  • Daniel Stenberg

    Daniel Stenberg - 2009-05-27
    • status: open-fixed --> closed-fixed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks