fix: restripe_lastframe returns falsy for both success and failure#2921
Open
deths74r wants to merge 1 commit intodankamongmen:masterfrom
Open
fix: restripe_lastframe returns falsy for both success and failure#2921deths74r wants to merge 1 commit intodankamongmen:masterfrom
deths74r wants to merge 1 commit intodankamongmen:masterfrom
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
restripe_lastframe()has return typenccell*but returns0(NULL) for success andNULLfor 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 freedlastframe.Fix
Return a truthy sentinel
(nccell*)1on malloc failure so the caller's error check works.A cleaner fix would change the return type to
intand return-1for failure, but that requires updating the static function signature.