render: don't free blur_kerns_cache when it's not used

blur_kernel_count could be none zero when user set a blur kernel but
didn't enable blur. In that case deinit_render will try to free
elements of blur_kerns_cache, causing a segfault because
blur_kerns_cache is never allocated.

Fixes #209

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-07-31 23:50:29 +01:00
parent ea6f355a6b
commit 1f80c8dc16
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
1 changed files with 5 additions and 3 deletions

View File

@ -1216,10 +1216,12 @@ void deinit_render(session_t *ps) {
}
#endif
for (int i = 0; i < ps->o.blur_kernel_count; i++) {
free(ps->blur_kerns_cache[i]);
if (ps->o.blur_method != BLUR_METHOD_NONE) {
for (int i = 0; i < ps->o.blur_kernel_count; i++) {
free(ps->blur_kerns_cache[i]);
}
free(ps->blur_kerns_cache);
}
free(ps->blur_kerns_cache);
}
// vim: set ts=8 sw=8 noet :