]> sigrok.org Git - libsigrokdecode.git/commitdiff
instance.c: Fix a memory leak reported by scan-build.
authorUwe Hermann <redacted>
Tue, 15 May 2018 22:13:07 +0000 (00:13 +0200)
committerUwe Hermann <redacted>
Wed, 16 May 2018 10:17:42 +0000 (12:17 +0200)
  instance.c:280:10: warning: Potential leak of memory pointed to by 'new_channelmap'
                  pdch = g_slist_nth(di->decoder->channels, i)->data;
                         ^~~~~~~~~~~

instance.c

index f8cd2c68f66804833d0f41e75e885c27c5b86a4d..a94118f2430de4991f70708522999fc49e02b53c 100644 (file)
@@ -280,6 +280,7 @@ SRD_API int srd_inst_channel_set_all(struct srd_decoder_inst *di,
                pdch = g_slist_nth(di->decoder->channels, i)->data;
                srd_err("Required channel '%s' (index %d) was not specified.",
                        pdch->id, i);
                pdch = g_slist_nth(di->decoder->channels, i)->data;
                srd_err("Required channel '%s' (index %d) was not specified.",
                        pdch->id, i);
+               g_free(new_channelmap);
                return SRD_ERR;
        }
 
                return SRD_ERR;
        }