]> sigrok.org Git - libsigrok.git/commitdiff
input/raw_analog: silence "use after free" compiler warning
authorGerhard Sittig <redacted>
Thu, 8 Feb 2018 20:47:21 +0000 (21:47 +0100)
committerGerhard Sittig <redacted>
Thu, 8 Feb 2018 20:47:21 +0000 (21:47 +0100)
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.

src/input/raw_analog.c

index f6a02635ddde8f6ebc178e2a1abc47c9c24d5ad2..68ac1c956fdefa6b4c200826507ed47f9b658b98 100644 (file)
@@ -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;