From d5db6ea7e17b5f8b8f13dd67fdb7e126931fdb05 Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Sat, 19 May 2018 21:56:07 +0200 Subject: [PATCH] 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; ^~~~~~ --- src/hardware/lecroy-xstream/protocol.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; + } } /*