dhobsd / castty

A CLI tool to record audio-enabled screencasts of your terminal, for the web.
Other
117 stars 15 forks source link

audio.c: Fix use of uninitialised "lame" when not using mp3 #17

Closed EliteTK closed 7 years ago

EliteTK commented 7 years ago

Fix uninitialised use of variable lame in function writer when mp3 output is not enabled. Additionally, lame_close was also being called on a potentially uninitialised value.

Since libmp3lame handles passing a NULL to any of its functions gracefully (although this is not documented), the variable lame is now also initialised to NULL, this also prevents future accidents where calls to libmp3lame functions are not guarded with an if (mp3).

Finally, this also silences a gcc warning about potentially uninitialised use of the variable lame.

EliteTK commented 7 years ago

Also added a fix for a related memory leak.