From: Uwe Hermann Date: Sat, 19 May 2018 19:56:07 +0000 (+0200) Subject: lecroy-xstream: Fix a potential memory leak. X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=d5db6ea7e17b5f8b8f13dd67fdb7e126931fdb05 lecroy-xstream: Fix a potential memory leak. Reported by scan-build: src/hardware/lecroy-xstream/protocol.c:680:12: warning: Potential leak of memory pointed to by 'analog.data' return SR_ERR; ^~~~~~ --- diff --git a/src/hardware/lecroy-xstream/protocol.c b/src/hardware/lecroy-xstream/protocol.c index 03cf88ce..8a2129a7 100644 --- a/src/hardware/lecroy-xstream/protocol.c +++ b/src/hardware/lecroy-xstream/protocol.c @@ -676,8 +676,10 @@ SR_PRIV int lecroy_xstream_receive_data(int fd, int revents, void *cb_data) } else { /* Update sample rate if needed. */ if (state->sample_rate == 0) - if (lecroy_xstream_update_sample_rate(sdi, analog.num_samples) != SR_OK) + if (lecroy_xstream_update_sample_rate(sdi, analog.num_samples) != SR_OK) { + g_free(analog.data); return SR_ERR; + } } /*