From 3344d1a728d37f0fb3e82a6a945eee0c780eb734 Mon Sep 17 00:00:00 2001 From: Chernov Dmitriy <cd_work@mail.ru> Date: 周三, 02 3月 2016 21:29:32 +0800 Subject: [PATCH] Fix potential memory leak. #73 --- examples/common/scpi-def.c | 26 +++++--------------------- 1 files changed, 5 insertions(+), 21 deletions(-) diff --git a/examples/common/scpi-def.c b/examples/common/scpi-def.c index dde9217..809fb1e 100644 --- a/examples/common/scpi-def.c +++ b/examples/common/scpi-def.c @@ -345,7 +345,7 @@ return SCPI_RES_OK; } -static const scpi_command_t scpi_commands[] = { +const scpi_command_t scpi_commands[] = { /* IEEE Mandated Commands (SCPI std V1999.0 4.1.1) */ { .pattern = "*CLS", .callback = SCPI_CoreCls,}, { .pattern = "*ESE", .callback = SCPI_CoreEse,}, @@ -403,7 +403,7 @@ SCPI_CMD_LIST_END }; -static scpi_interface_t scpi_interface = { +scpi_interface_t scpi_interface = { .error = SCPI_Error, .write = SCPI_Write, .control = SCPI_Control, @@ -411,23 +411,7 @@ .reset = SCPI_Reset, }; -#define SCPI_INPUT_BUFFER_LENGTH 256 -static char scpi_input_buffer[SCPI_INPUT_BUFFER_LENGTH]; +char scpi_input_buffer[SCPI_INPUT_BUFFER_LENGTH]; +int16_t scpi_error_queue_data[SCPI_ERROR_QUEUE_SIZE]; -static scpi_reg_val_t scpi_regs[SCPI_REG_COUNT]; - - -scpi_t scpi_context = { - .cmdlist = scpi_commands, - .buffer = - { - .length = SCPI_INPUT_BUFFER_LENGTH, - .data = scpi_input_buffer, - }, - .interface = &scpi_interface, - .registers = scpi_regs, - .units = scpi_units_def, - .idn = - {"MANUFACTURE", "INSTR2013", NULL, "01-02"}, -}; - +scpi_t scpi_context; -- Gitblit v1.9.1