asprintf: set result ptr to NULL on error
Checks
Context |
Check |
Description |
dj/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
dj/TryBot-32bit |
success
|
Build for i686
|
redhat-pt-bot/TryBot-still_applies |
warning
|
Patch no longer applies to master
|
Commit Message
This is what other implementations do, and it's too easy to assume this
is being done. Thus, let's avoid a footgun.
Signed-off-by: Adam Borowski <kilobyte@angband.pl>
---
libio/vasprintf.c | 1 +
1 file changed, 1 insertion(+)
@@ -95,6 +95,7 @@ int
__vasprintf_internal (char **result_ptr, const char *format, va_list args,
unsigned int mode_flags)
{
+ *result_ptr = NULL;
struct __printf_buffer_asprintf buf;
__printf_buffer_init (&buf.base, buf.direct, array_length (buf.direct),
__printf_buffer_mode_asprintf);