Post B4i5GKapDBaSpczQhM by oisin@mastodon.ie
(DIR) More posts by oisin@mastodon.ie
(DIR) Post #B4hmqhJ6L9ZuZfKKhs by libreleah@mas.to
0 likes, 0 repeats
this is how you do malloc safely in C: https://browse.libreboot.org/lbmk.git/commit/?id=7f39ce5f9b635444e06302fbe556709e84bf3b9ai'll probably add some wrappers for stuff like realloc/calloc too.yes, lots of C programmers will leak memory by e.g. not freeing a pointer first before setting it again to something else, or they will e.g. double-free.in my code, i call free() through a wrapper function that sets the original pointer to null. and now i have smalloc - error/abort if non-null given to smalloc. a bit extreme but i'm extremely serious about safety.
(DIR) Post #B4i5GKapDBaSpczQhM by oisin@mastodon.ie
0 likes, 0 repeats
@libreleah ""Tried to vmalloc(0) and that is very bad. Fix it now" :sickos: :sickos2: