From: Daniel Elstner Date: Thu, 20 Feb 2014 23:50:22 +0000 (+0100) Subject: parse_probestring: Fix memory leak on error. X-Git-Tag: sigrok-cli-0.5.0~36 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=6df458b71ace93941780153b79b348d4fd99493d;p=sigrok-cli.git parse_probestring: Fix memory leak on error. --- diff --git a/parsers.c b/parsers.c index f587f8d..12b3766 100644 --- a/parsers.c +++ b/parsers.c @@ -120,6 +120,7 @@ range_fail: if (!names[0] || (names[1] && names[2])) { /* Need one or two arguments. */ g_critical("Invalid probe '%s'.", tokens[i]); + g_strfreev(names); ret = SR_ERR; break; } @@ -127,6 +128,7 @@ range_fail: probe = find_probe(sdi->probes, names[0]); if (!probe) { g_critical("unknown probe '%s'.", names[0]); + g_strfreev(names); ret = SR_ERR; break; } @@ -137,8 +139,7 @@ range_fail: } probelist = g_slist_append(probelist, probe); - if (names) - g_strfreev(names); + g_strfreev(names); } }