Hi

I would like a little confirmation on a memory leak that I think I have 
found. In luv_fs the uv req and allocated ref are freed if the fs call is 
successful but they do not seem to be if the call throws an error:

#define FS_CALL(func, cb_index, path, ...)                                 
   \
  do {                                                                     
   \
    uv_err_t err;                                                           
  \
    int argc;                                                               
  \
    if (lua_isfunction(L, cb_index)) {                                     
   \
      if (uv_fs_##func(luv_get_loop(L), req, __VA_ARGS__, luv_after_fs)) { 
 \
        err = uv_last_error(luv_get_loop(L));                               
  \
        luv_push_async_error(L, err, #func, path);                         
   \
>>> NO CLEANUP HERE
        return lua_error(L);                                               
   \
      }                                                                     
  \
      return 0;                                                             
  \
    }                                                                       
  \
    if (uv_fs_##func(luv_get_loop(L), req, __VA_ARGS__, NULL) < 0) {       
 \
      err = uv_last_error(luv_get_loop(L));                                 
\
      luv_push_async_error(L, err, #func, path);                           
   \
>>> NO CLEANUP HERE
      return lua_error(L);                                                 
   \
    }                                                                       
  \
    argc = luv_process_fs_result(L, req);                                 \
    lua_remove(L, -argc - 1);                                               
  \
>>> uv_fs_req_cleanup SHOULD BE CALLED HERE
    return argc;                                                           
   \
  } while (0)

Am I correct in thinking this is a problem? I'm seeing a lot of valgrind 
issues (yes I do have LuaJit valgrind switched on and am using the supp 
file)

I also think uv_fs_req_cleanup should be called in the case that there is 
no callback even on success. Do you agree?

I'm a little new on libuv so I'm not entirely sure of myself.

Thanks

Martin

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

Reply via email to