defensive: NULL-check calloc results before dereferencing

Five sites allocated with calloc() and dereferenced the result on the
very next line. Under OOM the module would have segfaulted instead of
degrading. Each site now bails (or sends a Canceled D-Bus error, in
the agent path) when the allocation fails.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
nemunaire 2026-04-29 18:27:44 +07:00
commit 8b3ef2c346
5 changed files with 7 additions and 0 deletions

View file

@ -68,6 +68,7 @@ wifi_auth_prompt(Evas_Object *parent EINA_UNUSED, const char *ssid,
Wifi_Auth_Cb cb, void *data)
{
Auth_Ctx *c = calloc(1, sizeof(*c));
if (!c) return NULL;
c->cb = cb; c->data = data;
/* A floating top-level window so the popup is actually visible —