]> sigrok.org Git - sigrok-cli.git/blobdiff - parsers.c
Use g_try_malloc/g_free/g_strdup consistently.
[sigrok-cli.git] / parsers.c
index 2dbbd930095be243ef5fc71d44af31857ad58b35..fdf8562f365f73a04a4099f361eadceade29e191 100644 (file)
--- a/parsers.c
+++ b/parsers.c
@@ -33,7 +33,9 @@ char **parse_probestring(int max_probes, const char *probestring)
 
        error = FALSE;
        range = NULL;
-       probelist = g_malloc0(max_probes * sizeof(char *));
+       if (!(probelist = g_try_malloc0(max_probes * sizeof(char *)))) {
+               /* TODO: Handle errors. */
+       }
        tokens = g_strsplit(probestring, ",", max_probes);
 
        for (i = 0; tokens[i]; i++) {