[PATCH 1/6] sg: add missing free(msg); in ->errdetails() handler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Tomohiro Kusumi <tkusumi@xxxxxxxxxx>

msg gets malloc'd unconditionally, so we need to free msg if we're
not using msg for ret (strdup isn't really needed here to begin with).

Signed-off-by: Tomohiro Kusumi <tkusumi@xxxxxxxxxx>
---
 engines/sg.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/engines/sg.c b/engines/sg.c
index 2148e87..9d339bd 100644
--- a/engines/sg.c
+++ b/engines/sg.c
@@ -759,8 +759,10 @@ static char *fio_sgio_errdetails(struct io_u *io_u)
 		}
 	}
 
-	if (!ret)
+	if (!ret) {
 		ret = strdup("SG Driver did not report a Host, Driver or Device check");
+		free(msg);
+	}
 
 	return ret;
 }
-- 
2.9.4

--
To unsubscribe from this list: send the line "unsubscribe fio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux