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 2148e87c190f8c1dfc4f648aecb99796888ca777..9d339bd345554e671395e9c96fc13c66c0c14dab 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");
                ret = strdup("SG Driver did not report a Host, Driver or Device check");
+               free(msg);
+       }
 
        return ret;
 }
 
        return ret;
 }