From: Gerhard Sittig Date: Thu, 8 Feb 2018 21:31:48 +0000 (+0100) Subject: beaglelogic: fixup use of uninitialized data in TCP routines X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=05b0cc416fbfe95fb6440a786942a61dc1eeac52;p=libsigrok.git beaglelogic: fixup use of uninitialized data in TCP routines Make sure that failure to communicate via TCP results in access to uninitialized data. This was reported by clang's scan-build. --- diff --git a/src/hardware/beaglelogic/beaglelogic_tcp.c b/src/hardware/beaglelogic/beaglelogic_tcp.c index 24355240..c236c949 100644 --- a/src/hardware/beaglelogic/beaglelogic_tcp.c +++ b/src/hardware/beaglelogic/beaglelogic_tcp.c @@ -172,6 +172,7 @@ static int beaglelogic_tcp_get_string(struct dev_context *devc, const char *cmd, int len; gint64 timeout; + *tcp_resp = NULL; if (cmd) { if (beaglelogic_tcp_send_cmd(devc, cmd) != SR_OK) return SR_ERR; @@ -288,9 +289,11 @@ static int beaglelogic_get_samplerate(struct dev_context *devc) int arg, err; err = beaglelogic_tcp_get_int(devc, "samplerate", &arg); - devc->cur_samplerate = arg; + if (err) + return err; - return err; + devc->cur_samplerate = arg; + return SR_OK; } static int beaglelogic_set_samplerate(struct dev_context *devc)