spa: fix spa_api_method_null macro NULL checks

What may be NULL in these methods is the pointer to the object
containing the spa_interface, not the interface pointer itself.

Fixes spa-acp-tool crashing with NULL deref in spa_i18n.
This commit is contained in:
Pauli Virtanen 2024-12-07 13:43:07 +02:00 committed by Wim Taymans
parent 2d30ab94c2
commit 61f9018e15
3 changed files with 14 additions and 10 deletions

View file

@ -64,7 +64,7 @@ SPA_FORMAT_ARG_FUNC(2)
SPA_API_I18N const char *
spa_i18n_text(struct spa_i18n *i18n, const char *msgid)
{
return spa_api_method_null_r(const char *, msgid, spa_i18n, &i18n->iface,
return spa_api_method_null_r(const char *, msgid, spa_i18n, i18n, &i18n->iface,
text, 0, msgid);
}
@ -73,7 +73,7 @@ spa_i18n_ntext(struct spa_i18n *i18n, const char *msgid,
const char *msgid_plural, unsigned long int n)
{
return spa_api_method_null_r(const char *, n == 1 ? msgid : msgid_plural,
spa_i18n, &i18n->iface, ntext, 0, msgid, msgid_plural, n);
spa_i18n, i18n, &i18n->iface, ntext, 0, msgid, msgid_plural, n);
}
/**