sg: add missing free(msg); in ->errdetails() handler
authorTomohiro Kusumi <tkusumi@tuxera.com>
Mon, 12 Jun 2017 20:02:06 +0000 (23:02 +0300)
committerJens Axboe <axboe@fb.com>
Mon, 12 Jun 2017 20:51:01 +0000 (14:51 -0600)
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@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
engines/sg.c

index 2148e87..9d339bd 100644 (file)
@@ -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;
 }