summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-bin-debugger/tools/mrdb/cmdmisc.c
diff options
context:
space:
mode:
Diffstat (limited to 'mrbgems/mruby-bin-debugger/tools/mrdb/cmdmisc.c')
-rw-r--r--mrbgems/mruby-bin-debugger/tools/mrdb/cmdmisc.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/mrbgems/mruby-bin-debugger/tools/mrdb/cmdmisc.c b/mrbgems/mruby-bin-debugger/tools/mrdb/cmdmisc.c
index a05ff9415..fde65fbef 100644
--- a/mrbgems/mruby-bin-debugger/tools/mrdb/cmdmisc.c
+++ b/mrbgems/mruby-bin-debugger/tools/mrdb/cmdmisc.c
@@ -8,6 +8,7 @@
#include <string.h>
#include "apilist.h"
+#include "apistring.h"
#include <mruby/compile.h>
typedef struct help_msg {
@@ -232,10 +233,7 @@ parse_filename(mrb_state *mrb, char **sp, listcmd_parser_state *st)
len = strlen(*sp);
}
- if (len > 0) {
- st->filename = (char*)mrb_malloc(mrb, len + 1);
- strncpy(st->filename, *sp, len);
- st->filename[len] = '\0';
+ if (len > 0 && (st->filename = mrb_debug_strndup(mrb, *sp, len)) != NULL) {
*sp += len;
return TRUE;
}