hook: don't remove from unitialized list

A lot of code calls spa_hook_remove() from error paths where the hook
and therefore the list may not have been initialized.
This leads to null-derefences.
This commit is contained in:
Thomas Weißschuh 2022-08-23 23:47:52 +02:00 committed by Wim Taymans
parent b23b0e6125
commit 2394413ec3
2 changed files with 8 additions and 1 deletions

View file

@ -419,6 +419,12 @@ PWTEST(utils_hook)
}
pwtest_int_eq(count, 4);
pwtest_int_eq(hook_free_count, 4);
/* remove a zeroed hook */
struct spa_hook hook;
spa_zero(hook);
spa_hook_remove(&hook);
return PWTEST_PASS;
}