Fix UAF spotted by asan

This commit is contained in:
Sergi Àlvarez i Capilla 2022-01-20 15:49:15 +01:00
parent 1d41ee33e4
commit c3310c5ae1

View File

@ -373,11 +373,12 @@ static void recursive_help(RCore *core, int detail, const char *cmd_prefix) {
recursive_help (core, detail, "??");
recursive_help (core, detail, "~");
}
char *s = r_core_cmd_strf (core, "%s?", cmd_prefix);
RList *pending = r_list_newf (free);
r_cons_print (s);
RList *rows = r_str_split_list (s, "\n", 0);
free (s);
RListIter *iter;
char *row;
r_list_foreach (rows, iter, row) {
@ -400,6 +401,7 @@ static void recursive_help(RCore *core, int detail, const char *cmd_prefix) {
}
}
r_list_free (rows);
free (s);
r_list_foreach (pending, iter, row) {
recursive_help (core, detail, row);
}