Open
Description
These lines of code leak:
Lines 122 to 123 in a1fbb65
parseText()
allocates a string and returns it:Line 288 in a1fbb65
If you pass a font file multiple times to the note feature, it will assign the return value of parseText()
to note->font
without free()
ing note->font
first. This leaks filenames as many times as font files are repeatedly specified.
I'd personally just remove the note feature entirely, but the fix is to make sure note->font
is initialized to NULL
and then free()
it before calling parseText()
.
Edit: here's an example that leaks memory:
$ scrot -n "-f '/usr/share/fonts/TTF/DroidSans-Bold/40' -f '/usr/share/fonts/TTF/DroidSans-Bold/40' -x 10 -y 20 -c 255,0,0,255 -t 'Hi'"