On 14/07/2020 19.46, Alexander Bulekov wrote: > In the initial FuzzTarget, get_init_cmdline returned a char *. With this > API, we had no guarantee about where the string came from. For example, > i440fx-qtest-reboot-fuzz simply returned a pointer to a string literal, > while the QOS-based targets build the arguments out in a GString an > return the gchar *str pointer. Since we did not try to free the cmdline, > we have a leak for any targets that do not simply return string > literals. Clean up this mess by forcing fuzz-targets to return > a GString, that we can free. > > Signed-off-by: Alexander Bulekov <[email protected]> > --- > tests/qtest/fuzz/fuzz.c | 13 ++++++------- > tests/qtest/fuzz/fuzz.h | 6 +++--- > tests/qtest/fuzz/i440fx_fuzz.c | 4 ++-- > tests/qtest/fuzz/qos_fuzz.c | 6 +++--- > 4 files changed, 14 insertions(+), 15 deletions(-) /* Prepend the arguments that we need */ > g_string_prepend(cmd_line, > TARGET_NAME " -display none -machine accel=qtest -m 64 "); > - return cmd_line->str; > + return cmd_line; > } > > /* > @@ -189,7 +189,7 @@ static void walk_path(QOSGraphNode *orig_path, int len) > g_free(path_str); > } > > -static const char *qos_get_cmdline(FuzzTarget *t) > +static GString *qos_get_cmdline(FuzzTarget *t) > { > /* > * Set a global variable that we use to identify the qos_path for our >
Reviewed-by: Thomas Huth <[email protected]> ... and queued to my "qtest-next" branch. Thanks, Thomas
