From da6f107efffbc7b2744f1ca69e8dc3d0c71a0a4a Mon Sep 17 00:00:00 2001 From: Gerhard Sittig Date: Thu, 8 Feb 2018 22:08:54 +0100 Subject: [PATCH] scpi: avoid uninitialized use of a variable The 'opc' variable was only conditionally assigned to (depends on successful SCPI communication). Ensure there always is a known value. This was reported by clang's scan-build. --- src/scpi/scpi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/scpi/scpi.c b/src/scpi/scpi.c index 511e3cd2..5b36daab 100644 --- a/src/scpi/scpi.c +++ b/src/scpi/scpi.c @@ -651,6 +651,7 @@ SR_PRIV int sr_scpi_get_opc(struct sr_scpi_dev_inst *scpi) gboolean opc; for (i = 0; i < SCPI_READ_RETRIES; i++) { + opc = FALSE; sr_scpi_get_bool(scpi, SCPI_CMD_OPC, &opc); if (opc) return SR_OK;