symsynd icon indicating copy to clipboard operation
symsynd copied to clipboard

Field message stored a boxed slice in CError should be cleaned in Drop impl.

Open labyrinth-ssr opened this issue 2 years ago • 0 comments

https://github.com/getsentry/symsynd/blob/13825f10bfb9291fe7bcd13937ddf398e7104234/libdebug/src/cabi.rs#L19-L24 https://github.com/getsentry/symsynd/blob/13825f10bfb9291fe7bcd13937ddf398e7104234/libdebug/src/cabi.rs#L72-L79

The destructor won't release CError.message (on the heap since (*err_out).message = Box::into_raw(s.into_boxed_str()) as *mut u8; ), causing memory leak.

To free the field, probable fix is like: https://github.com/getsentry/symsynd/blob/13825f10bfb9291fe7bcd13937ddf398e7104234/libdebug/src/cabi.rs#L128-L133

or to implement drop for CError

labyrinth-ssr avatar Jul 27 '23 11:07 labyrinth-ssr