summaryrefslogtreecommitdiffstats
path: root/src/client.c
diff options
context:
space:
mode:
authorGravatar Comtea042026-10-05 11:44:56 +0900
committerGravatar Nikias Bassen2026-11-22 18:05:59 +0100
commitda392d27f2d8938bf002093bb94dc60beba6afd8 (patch)
tree36d21dc8f5246884b5dc319856e86f2adf042465 /src/client.c
parent7741349485f0741e8b2dbccd936faf487c3bdee4 (diff)
downloadusbmuxd-da392d27f2d8938bf002093bb94dc60beba6afd8.tar.gz
usbmuxd-da392d27f2d8938bf002093bb94dc60beba6afd8.tar.bz2
utils: Handle realloc() failure in fdlist_add()
fdlist_add() assigned the results of realloc() directly to list->owners and list->fds and doubled the capacity unconditionally, so on out-of-memory the arrays were leaked and the following stores wrote through a NULL pointer, crashing the daemon. Only update the pointers and the capacity once the reallocation succeeded. If it fails, log an error and leave the fd out of this poll() round; the main loop rebuilds the list on every iteration. A capacity of 0 (after fdlist_free()) now grows to 4 instead of staying 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'src/client.c')
0 files changed, 0 insertions, 0 deletions