From: Gerhard Sittig Date: Thu, 8 Feb 2018 20:47:21 +0000 (+0100) Subject: input/raw_analog: silence "use after free" compiler warning X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=603643fa71d5f3523e81bbda079eeebbeaeb2273;p=libsigrok.git input/raw_analog: silence "use after free" compiler warning The cleanup() call will void the memory which 'inc' points to. Move the dereference before the release. This was reported by clang's scan-build. --- diff --git a/src/input/raw_analog.c b/src/input/raw_analog.c index f6a02635..68ac1c95 100644 --- a/src/input/raw_analog.c +++ b/src/input/raw_analog.c @@ -271,8 +271,8 @@ static int reset(struct sr_input *in) { struct context *inc = in->priv; - cleanup(in); inc->started = FALSE; + cleanup(in); g_string_truncate(in->buf, 0); return SR_OK;