From: Gerhard Sittig Date: Thu, 8 Feb 2018 21:08:54 +0000 (+0100) Subject: scpi: avoid uninitialized use of a variable X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=da6f107efffbc7b2744f1ca69e8dc3d0c71a0a4a;p=libsigrok.git 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. --- 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;