Hey there again. curel_easy_perform will block until the request is finished, so there is no danger of your callback getting called after the free.
If ever you don't want to block your program execution while a request happens, you can check out the multi interface. >From what it sounds like, blocking should be fine for your application though. On Sun, Feb 27, 2011 at 8:23 PM, <[email protected]> wrote: > Hi everyone. I'm a newbie trying to learn C99 and write a Wikipedia bot in > C. > > My code does the following things: > > buffer = malloc (buffersize) ; > curl_easy_setopt ( curlhandle, CURLOPT_WRITEFUNCTION, Writememorycallback ) > ; > curl_easy_setopt ( curlhandle, CURLOPT_WRITEDATA, &chunk ) ; > curl_easy_perform (); > > free(buffer); > > Now, I'm anxious about the possibility that Writememorycallback is going to > be called after the free() has released the memory that it's writing into. > Do I need to 'cancel' the callback function to be sure? > > Richard > > > ------------------------------------------------------------------- > List admin: http://cool.haxx.se/list/listinfo/curl-library > Etiquette: http://curl.haxx.se/mail/etiquette.html > ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html
