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
In the referenced code, the argument to malloc is incorrect. Both the type and the variable are named buffer, but sizeof prefers the variable. Since the variable is a pointer, only the size of a pointer is allocated.
The text was updated successfully, but these errors were encountered:
Thanks! It's probably gone unnoticed so long because malloc() typically
allocates double the pointer size at a minimum, and so the real allocation
worked out anyway.
Revisiting this old code, I see I still had a whole lot to learn about C 8
years ago! If I wrote it today it would look quite different.
https://github.com/skeeto/emacsql/blob/c82a0e6b4d256a3743b718cfb640fa9efc045f6e/sqlite/emacsql.c#L45
In the referenced code, the argument to malloc is incorrect. Both the type and the variable are named
buffer
, butsizeof
prefers the variable. Since the variable is a pointer, only the size of a pointer is allocated.The text was updated successfully, but these errors were encountered: