From cad3a1a82da3c8421b5cc98af27a779a38b5c709 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 12 Sep 2018 11:05:45 +1000 Subject: [PATCH] posix_tty: free leak of xf86SetStrOption return value. Pointed out by coverity. Signed-off-by: Dave Airlie --- hw/xfree86/os-support/shared/posix_tty.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/xfree86/os-support/shared/posix_tty.c b/hw/xfree86/os-support/shared/posix_tty.c index 6768d290b..0cb9788cc 100644 --- a/hw/xfree86/os-support/shared/posix_tty.c +++ b/hw/xfree86/os-support/shared/posix_tty.c @@ -188,7 +188,7 @@ xf86SetSerial(int fd, XF86OptionPtr options) { struct termios t; int val; - const char *s; + char *s; int baud, r; if (fd < 0) @@ -264,8 +264,10 @@ xf86SetSerial(int fd, XF86OptionPtr options) } else { xf86Msg(X_ERROR, "Invalid Option Parity value: %s\n", s); + free(s); return -1; } + free(s); } if ((val = xf86SetIntOption(options, "Vmin", -1)) != -1) { @@ -291,8 +293,10 @@ xf86SetSerial(int fd, XF86OptionPtr options) } else { xf86Msg(X_ERROR, "Invalid Option FlowControl value: %s\n", s); + free(s); return -1; } + free(s); } if ((xf86SetBoolOption(options, "ClearDTR", FALSE))) {