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
chewing_get_selKey used to return a pointer to new malloc'ed memory, which is safe to be deallocated by free()
Now it returns a pointer to a per ChewingContext data structure, it's no longer safe to free() it and it's not thread safe.
To Reproduce
Steps to reproduce the behavior:
Call chewing_get_selKey
Call free() on the returned pointer
Sometimes this causes a crash.
Expected behavior
New memory should be allocated every time.
Platform (please complete the following information):
OS: All
Version: 0.8.0
Additional context
Currently chewing_free() ignores invalid pointer - so programs following the doc and always free chewing objects with chewing_free() are not affected. Freeing chewing objects with system libc free() invokes undefined behavior.
The text was updated successfully, but these errors were encountered:
Describe the bug
chewing_get_selKey
used to return a pointer to new malloc'ed memory, which is safe to be deallocated byfree()
Now it returns a pointer to a per
ChewingContext
data structure, it's no longer safe tofree()
it and it's not thread safe.To Reproduce
Steps to reproduce the behavior:
chewing_get_selKey
free()
on the returned pointerExpected behavior
New memory should be allocated every time.
Platform (please complete the following information):
Additional context
Currently
chewing_free()
ignores invalid pointer - so programs following the doc and always free chewing objects withchewing_free()
are not affected. Freeing chewing objects with system libcfree()
invokes undefined behavior.The text was updated successfully, but these errors were encountered: