On 12/20/2013 06:39 AM, Sarav Sandhu wrote:
Hi Ben/libuv team,

While analysing the memory allocation with valgrind memory analyser
tool, I've observed the following error while calling free() in
uv_close's callback :

==32732==
==32732== Invalid free() / delete / delete[]
==32732==    at 0x4004FDA: free (vg_replace_malloc.c:233)
==32732==    by 0x80521A3: uv__finish_close (core.c:204)
==32732==    by 0x80521DA: uv__run_closing_handles (core.c:218)
==32732==    by 0x8052457: uv_run (core.c:316)
==32732==    by 0x8050328: ppp (ppp.c:96)
==32732==    by 0x804AD79: main (main.c:108)
==32732==  Address 0x806B880 is not stack'd, malloc'd or (recently) free'd
==32732==

The code for the same is :

void on_file_write(uv_write_t *req, int status) {
         uv_close( (uv_handle_t*) req->handle, (uv_close_cb) free );
         free( req->data );
}

uv_write(writer, (uv_stream_t*) &req_file, &buf, 1, on_file_write);

How are you allocating writer here?

Also, do you have a small and libuv-only test case exposing the issue?


Thanks,

--
Saúl Ibarra Corretgé
bettercallsaghul.com

--
You received this message because you are subscribed to the Google Groups 
"libuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/libuv.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to