The contents of the pointer are undefined when vasprintf fails. NULL is the least confusing result here.
Signed-off-by: Peter Hutterer <[email protected]> --- libwacom/libwacom-error.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libwacom/libwacom-error.c b/libwacom/libwacom-error.c index 758506b..eff7ee2 100644 --- a/libwacom/libwacom-error.c +++ b/libwacom/libwacom-error.c @@ -75,7 +75,8 @@ libwacom_error_set(WacomError *error, enum WacomErrorCode code, const char *msg, if (msg) { va_list ap; va_start(ap, msg); - vasprintf(&error->msg, msg, ap); + if (vasprintf(&error->msg, msg, ap) == -1) + error->msg = NULL; va_end(ap); } } -- 2.4.1 ------------------------------------------------------------------------------ _______________________________________________ Linuxwacom-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
