From 9c999216b1601d762d4928b201bc7a9d8778f2aa Mon Sep 17 00:00:00 2001 From: mifi Date: Mon, 10 Dec 2007 19:46:04 +0000 Subject: - Fixing two compiler warnings - Reducing stack usage for recursive scripts - Do not exit on bogus arguments to reset_config. No longer exit the application upon bogus arguments to reset_config, but return errors. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit thanks to Øyvind Harboe for these patches. git-svn-id: svn://svn.berlios.de/openocd/trunk@226 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- src/helper/command.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/helper/command.c') diff --git a/src/helper/command.c b/src/helper/command.c index 11284a1c..f69deb49 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -383,7 +383,11 @@ int command_run_file(command_context_t *context, FILE *file, enum command_mode m { int retval = ERROR_OK; int old_command_mode; - char buffer[4096]; + char *buffer=malloc(4096); + if (buffer==NULL) + { + return ERROR_INVALID_ARGUMENTS; + } old_command_mode = context->mode; context->mode = mode; @@ -422,6 +426,9 @@ int command_run_file(command_context_t *context, FILE *file, enum command_mode m } context->mode = old_command_mode; + + + free(buffer); return retval; } -- cgit v1.2.3