Fix memleak in test_buf & test_cmd (#18162)

This commit is contained in:
Liumeo 2021-01-03 13:00:17 -05:00 committed by GitHub
parent 597289cf96
commit c96d68599f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 1 deletions

View File

@ -460,7 +460,9 @@ static void fill_children_chars(RStrBuf *sb, RCmdDesc *cd) {
r_strbuf_prepend (&csb, "<");
r_strbuf_append (&csb, ">");
}
r_strbuf_append (sb, r_strbuf_drain_nofree (&csb));
char *tmp = r_strbuf_drain_nofree (&csb);
r_strbuf_append (sb, tmp);
free (tmp);
}
static bool show_children_shortcut(RCmdDesc *cd) {

View File

@ -122,6 +122,7 @@ bool test_r_buf_file(void) {
// Cleanup
r_buf_free (b);
unlink (filename);
free (filename);
mu_end;
}
@ -165,6 +166,7 @@ bool test_r_buf_mmap(void) {
// Cleanup
r_buf_free (b);
unlink(filename);
free (filename);
mu_end;
}

View File

@ -166,6 +166,7 @@ bool test_cmd_descriptor_group(void) {
free (h);
r_cmd_free (cmd);
r_cmd_parsed_args_free (pa);
mu_end;
}