Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

memleak in vfree #14

Closed
frozencemetery opened this issue Jul 15, 2015 · 2 comments
Closed

memleak in vfree #14

frozencemetery opened this issue Jul 15, 2015 · 2 comments
Labels

Comments

@frozencemetery
Copy link
Member

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

@frozencemetery
Copy link
Member Author

2016-06-30 10:27:35: @greghudson commented


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.

@frozencemetery
Copy link
Member Author

Fixed by 968d542

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant