You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
verto_set_allocator(resize, hierarchical) has an unducumented
requirement on allocator function resize, that resize(ptr, 0) is
equivalent to free(ptr).
Some POSIX.1-2008 compliant implementations of the default allocator realloc don't
meet this requirement. realloc(ptr, 0) may return a unique pointer that can be
successfully passed to free. This new pointer never gets freed by libverto and the
memory overhead leaks.
This is not an issue for linux realloc implementation, but libverto has been bundled with MIT Kerberos. MIT Kerberos is supported on platforms like Oracle Solaris, where realloc(ptr, 0) is not equivalent to free(ptr).
Note that even under glibc, realloc(NULL, 0) allocates memory and returns non-null--that is, it behaves like malloc(0) rather than free(NULL). So using realloc(x, 0) as a synonym for free(x) only works if you are careful not to free null pointers, which is of course inconvenient.
Issue migrated from trac ticket # 13
component: component1 | priority: major
2015-07-15 16:53:02: @tkuthan created the issue
verto_set_allocator(resize, hierarchical) has an unducumented
requirement on allocator function resize, that resize(ptr, 0) is
equivalent to free(ptr).
Some POSIX.1-2008 compliant implementations of the default allocator realloc don't
meet this requirement. realloc(ptr, 0) may return a unique pointer that can be
successfully passed to free. This new pointer never gets freed by libverto and the
memory overhead leaks.
This is not an issue for linux realloc implementation, but libverto has been bundled with MIT Kerberos. MIT Kerberos is supported on platforms like Oracle Solaris, where realloc(ptr, 0) is not equivalent to free(ptr).
See krb5/krb5#294
The text was updated successfully, but these errors were encountered: