diff --git a/src/hardware/fluke-45/api.c b/src/hardware/fluke-45/api.c index 16c7dc03..2e80b6bf 100644 --- a/src/hardware/fluke-45/api.c +++ b/src/hardware/fluke-45/api.c @@ -78,16 +78,20 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi) sr_scpi_get_string(scpi, "ECHO-TEST", &response); if (response && strcmp(response, "ECHO-TEST") == 0) { sr_err("Serial port ECHO is ON. Please turn it OFF!"); + g_free(response); return NULL; } + g_free(response); #endif /* Get device IDN. */ if (sr_scpi_get_hw_id(scpi, &hw_info) != SR_OK) { + sr_scpi_hw_info_free(hw_info); sr_info("Couldn't get IDN response, retrying."); sr_scpi_close(scpi); sr_scpi_open(scpi); if (sr_scpi_get_hw_id(scpi, &hw_info) != SR_OK) { + sr_scpi_hw_info_free(hw_info); sr_info("Couldn't get IDN response."); return NULL; } diff --git a/src/hardware/fluke-45/protocol.c b/src/hardware/fluke-45/protocol.c index 5d9c3793..16489007 100644 --- a/src/hardware/fluke-45/protocol.c +++ b/src/hardware/fluke-45/protocol.c @@ -332,6 +332,7 @@ SR_PRIV int fl45_scpi_get_response(const struct sr_dev_inst *sdi, char *cmd) * If the response is a prompt then ignore and read the next * response in the buffer. */ + g_free(devc->response); devc->response = NULL; /* Now attempt to read again. */ if (sr_scpi_get_string(sdi->conn, NULL, &devc->response) != SR_OK) @@ -339,9 +340,10 @@ SR_PRIV int fl45_scpi_get_response(const struct sr_dev_inst *sdi, char *cmd) } /* NULL RS232 error prompts. */ - if (strcmp(devc->response, "!>") == 0 - || (strcmp(devc->response, "?>") == 0)) { + if (strcmp(devc->response, "!>") == 0 || + (strcmp(devc->response, "?>") == 0)) { /* Unable to execute CMD. */ + g_free(devc->response); devc->response = NULL; }