Skip to content

Commit

Permalink
Fix #2809 - based on @alvarofe patch
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Jun 21, 2015
1 parent 344cceb commit d93835b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions libr/core/cmd_magic.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/* ugly global vars */
static int magicdepth = 99; //XXX: do not use global var here
static RMagic *ck = NULL; // XXX: Use RCore->magic
static const char *ofile = NULL;
static char *ofile = NULL;

static int r_core_magic_at(RCore *core, const char *file, ut64 addr, int depth, int v) {
const char *fmt;
Expand Down Expand Up @@ -49,7 +49,8 @@ static int r_core_magic_at(RCore *core, const char *file, ut64 addr, int depth,
// allocate once
ck = r_magic_new (0);
if (file) {
ofile = file;
free (ofile);
ofile = strdup (file);
if (r_magic_load (ck, file) == -1) {
eprintf ("failed r_magic_load (\"%s\") %s\n", file, r_magic_error (ck));
ck = NULL;
Expand Down

0 comments on commit d93835b

Please sign in to comment.