Skip to content

fix: check *ret instead of ret in xvasprintf error path#96

Open
kugland wants to merge 1 commit into
emikulic:masterfrom
kugland:fix/xvasprintf-error-path
Open

fix: check *ret instead of ret in xvasprintf error path#96
kugland wants to merge 1 commit into
emikulic:masterfrom
kugland:fix/xvasprintf-error-path

Conversation

@kugland
Copy link
Copy Markdown
Contributor

@kugland kugland commented May 13, 2026

ret is the address of a local char* and is never NULL, so the OOM branch was dead. Test len == -1 first to short-circuit, since per vasprintf(3) the contents of *strp are undefined on error on GNU; the *ret == NULL check then covers the FreeBSD case, where the implementation sets strp to NULL on error.

ret is the address of a local char* and is never NULL, so the OOM
branch was dead. Test len == -1 first to short-circuit, since per
vasprintf(3) the contents of *strp are undefined on error on GNU;
the *ret == NULL check then covers the FreeBSD case, where the
implementation sets strp to NULL on error.
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