From 22cd25d36059c784ea0da3ebeed063414aad44d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Mon, 27 Jul 2020 06:03:30 +0200 Subject: [PATCH] tokenize: reset *argv = NULL on error This allows the caller to call free() without having to worry about whether it has already been free:d or not. Closes #49. --- tokenize.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tokenize.c b/tokenize.c index b4aab6b5..703ecb07 100644 --- a/tokenize.c +++ b/tokenize.c @@ -46,6 +46,7 @@ tokenize_cmdline(char *cmdline, char ***argv) if (delim != ' ') { LOG_ERR("unterminated %s quote\n", delim == '"' ? "double" : "single"); free(*argv); + *argv = NULL; return false; }