Skip to content

fix: restripe_lastframe returns falsy for both success and failure#2921

Open
deths74r wants to merge 1 commit intodankamongmen:masterfrom
deths74r:fix/restripe-lastframe-error
Open

fix: restripe_lastframe returns falsy for both success and failure#2921
deths74r wants to merge 1 commit intodankamongmen:masterfrom
deths74r:fix/restripe-lastframe-error

Conversation

@deths74r
Copy link
Copy Markdown

Summary

restripe_lastframe() has return type nccell* but returns 0 (NULL) for success and NULL for malloc failure. Both values are falsy.

The caller checks if(restripe_lastframe(...)) expecting truthy to indicate an error, so malloc failure is silently ignored. If OOM occurs during a terminal resize, the render pipeline continues with a stale or freed lastframe.

Fix

Return a truthy sentinel (nccell*)1 on malloc failure so the caller's error check works.

A cleaner fix would change the return type to int and return -1 for failure, but that requires updating the static function signature.

restripe_lastframe() has return type nccell* but returns 0 (NULL) for
success and NULL for malloc failure. Both are falsy. The caller at
line 93 checks if(restripe_lastframe(...)) expecting truthy=error,
so malloc failure is silently ignored.

Fix: return a truthy sentinel on malloc failure so the caller's
error check catches OOM conditions.

A cleaner fix would change the return type to int, but that requires
updating the static function signature declaration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant