aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mm-serial-port.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mm-serial-port.c b/src/mm-serial-port.c
index b2cdfa22..8b683dd3 100644
--- a/src/mm-serial-port.c
+++ b/src/mm-serial-port.c
@@ -571,6 +571,17 @@ mm_serial_port_queue_process (gpointer data)
const GByteArray *cached = mm_serial_port_get_cached_reply (self, info->command);
if (cached) {
+ /* Ensure the response array is fully empty before setting the
+ * cached response. */
+ if (priv->response->len > 0) {
+ g_warning ("%s: (%s) response array is not empty when using "
+ "cached reply, cleaning up %u bytes",
+ __func__,
+ mm_port_get_device (MM_PORT (self)),
+ priv->response->len);
+ g_byte_array_set_size (priv->response, 0);
+ }
+
g_byte_array_append (priv->response, cached->data, cached->len);
mm_serial_port_got_response (self, NULL);
return FALSE;