output/srzip: fix potential "use after free"
The compiler marks a potential use after free, which the current implementation won't trigger. The error only occurs when a sigrok channel is neither logic nor analog. Address the issue nevertheless, to silence the compiler warning, and to protect against possible programming errors when a future implementation should support more channel types. This was reported by clang's scan-build.
This commit is contained in:
parent
499f5045dd
commit
f396351704
|
@ -150,6 +150,7 @@ static int zip_create(const struct sr_output *o)
|
|||
if (!ch->enabled)
|
||||
continue;
|
||||
|
||||
s = NULL;
|
||||
switch (ch->type) {
|
||||
case SR_CHANNEL_LOGIC:
|
||||
s = g_strdup_printf("probe%d", ch->index + 1);
|
||||
|
@ -160,9 +161,11 @@ static int zip_create(const struct sr_output *o)
|
|||
index++;
|
||||
break;
|
||||
}
|
||||
if (s) {
|
||||
g_key_file_set_string(meta, devgroup, s, ch->name);
|
||||
g_free(s);
|
||||
}
|
||||
}
|
||||
|
||||
metabuf = g_key_file_to_data(meta, &metalen, NULL);
|
||||
g_key_file_free(meta);
|
||||
|
|
Loading…
Reference in New Issue