Project

General

Profile

« Previous | Next » 

Revision cbbe198c

Added by nobu (Nobuyoshi Nakada) over 5 years ago

Fix potential memory leaks by rb_imemo_tmpbuf_auto_free_pointer

This function has been used wrongly always at first, "allocate a
buffer then wrap it with tmpbuf". This order can cause a memory
leak, as tmpbuf creation also can raise a NoMemoryError exception.
The right order is "create a tmpbuf then allocate&wrap a buffer".
So the argument of this function is rather harmful than just
useless.

TODO:

  • Rename this function to more proper name, as it is not used
    "temporary" (function local) purpose.
  • Allocate and wrap at once safely, like ALLOCV.