]> sigrok.org Git - sigrok-cli.git/commitdiff
parse_probestring: Fix memory leak on error.
authorDaniel Elstner <redacted>
Thu, 20 Feb 2014 23:50:22 +0000 (00:50 +0100)
committerDaniel Elstner <redacted>
Thu, 20 Feb 2014 23:50:22 +0000 (00:50 +0100)
parsers.c

index f587f8d0e9da6701083a16283de0992e64b51c8f..12b37662eaecce07019f42655913777227ec987d 100644 (file)
--- 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);
                }
        }