Skip to content

Commit

Permalink
render: don't free blur_kerns_cache when it's not used
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
yshui committed Aug 1, 2019
1 parent cfa5fcc commit 4fa16db
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/render.c
Original file line number Diff line number Diff line change
Expand Up @@ -1198,10 +1198,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 :

0 comments on commit 4fa16db

Please sign in to comment.