klystron
klystron copied to clipboard
Cleanup of pointers in KSongInfo?
I understand if the song information should be safe to use indefinitely, you should use your own struct and pass it to GetSongInfo. However, the KSongInfo struct itself contains pointers, but not a way to dispose of the memory the pointers point to. What's the cleanup process for them? Are they static somehow, or a heap copy to be free()'d? The docs imply no freeing is necessary - although the lack of a "FreeSongInfo()" function is more implicit. Currently I'm strdup()'ng all the pointers - the title and instrument names, and freeing them in a wrapper struct. Could you please clarify on this point.
Everything in libksnd at least SHOULD be something that you don't need to free yourself, apart from using the KSND_Free* API's. Funnily enough, I looked into the ksnd.c file and thought the exact strings should probably be copied. Need to check what has been my train of thought there.
2018-01-02 7:31 GMT+02:00 Phi [email protected]:
I understand if the song information should be safe to use indefinitely, you should use your own struct and pass it to GetSongInfo. However, the KSongInfo struct itself contains pointers, but not a way to dispose of the memory the pointers point to. What's the cleanup process for them? Are they static somehow, or a heap copy to be free()'d? The docs imply no freeing is necessary - although the lack of a "FreeSongInfo()" function is more implicit. Currently I'm strdup()'ng all the pointers - the title and instrument names, and freeing them in a wrapper struct. Could you please clarify on this point.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kometbomb/klystron/issues/12, or mute the thread https://github.com/notifications/unsubscribe-auth/ABCK6b65Wo6SKa15A87JFBgdxjB8KY4Oks5tGb80gaJpZM4RQTJa .