Skip to content

Commit

Permalink
Fix 'cg' RCore's double-free issue
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Dec 9, 2013
1 parent f76441b commit 4bc74d0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions libr/cons/cons.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ R_API RCons *r_cons_new () {
I.line = r_line_new ();
I.event_interrupt = NULL;
I.blankline = R_TRUE;
I.teefile = NULL;
I.heightfix = 0;
I.widthfix = 0;
I.event_resize = NULL;
Expand Down
4 changes: 4 additions & 0 deletions libr/core/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,10 @@ R_API RCore *r_core_fini(RCore *c) {
//r_lang_free (c->lang); // XXX segfaults
r_debug_free (c->dbg);
r_config_free (c->config);
/* after r_config_free, the value of I.teefile is trashed */
/* rconfig doesnt knows how to deinitialize vars, so we
should probably need to add a r_config_free_payload callback */
r_cons_singleton()->teefile = NULL; // HACK
r_search_free (c->search);
r_sign_free (c->sign);
r_flag_free (c->flags);
Expand Down
1 change: 1 addition & 0 deletions libr/util/str.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "r_types.h"
#include "r_util.h"
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdarg.h>

Expand Down

0 comments on commit 4bc74d0

Please sign in to comment.