From d93835b08cd2390626d60ffb947103e0cd51752c Mon Sep 17 00:00:00 2001 From: pancake Date: Sun, 21 Jun 2015 10:00:41 +0200 Subject: [PATCH] Fix #2809 - based on @alvarofe patch --- libr/core/cmd_magic.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libr/core/cmd_magic.c b/libr/core/cmd_magic.c index afbf3e0efb7d1..918b545a6d3a7 100644 --- a/libr/core/cmd_magic.c +++ b/libr/core/cmd_magic.c @@ -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; @@ -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;