Check that hhk_helper pointer isn't NULL before access.

It isn't forbidden to use NULL pointer for hook_helper in hookinfo
structure when hhook_add_hook() adds new helper hook.
This commit is contained in:
Andrey V. Elsukov 2015-11-25 07:14:58 +00:00
parent c4492f4758
commit 0991fe0117
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=291291

View File

@ -101,7 +101,8 @@ hhook_run_hooks(struct hhook_head *hhh, void *ctx_data, struct osd *hosd)
HHH_RLOCK(hhh, &rmpt);
STAILQ_FOREACH(hhk, &hhh->hhh_hooks, hhk_next) {
if (hhk->hhk_helper->h_flags & HELPER_NEEDS_OSD) {
if (hhk->hhk_helper != NULL &&
hhk->hhk_helper->h_flags & HELPER_NEEDS_OSD) {
hdata = osd_get(OSD_KHELP, hosd, hhk->hhk_helper->h_id);
if (hdata == NULL)
continue;