From d5a2a361f635115070675bd8160cb0d94774b840 Mon Sep 17 00:00:00 2001 From: h_vogt Date: Sun, 4 Nov 2012 14:16:27 +0100 Subject: [PATCH] variable.c: add strict error handling --- src/frontend/variable.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/frontend/variable.c b/src/frontend/variable.c index 5503e0128..e12b8968f 100644 --- a/src/frontend/variable.c +++ b/src/frontend/variable.c @@ -301,7 +301,10 @@ cp_setparse(wordlist *wl) if (wl == NULL) { fprintf(cp_err, "Error: bad set form.\n"); tfree(name); /*DG: cp_unquote Memory leak*/ - return (NULL); + if (ft_stricterror) + controlled_exit(EXIT_BAD); + else + return (NULL); } val = wl->wl_word; wl = wl->wl_next; @@ -315,7 +318,10 @@ cp_setparse(wordlist *wl) if (!wl) { fprintf(cp_err, "Error: %s equals what?.\n", name); tfree(name); /*DG: cp_unquote Memory leak: free name before exiting*/ - return (NULL); + if (ft_stricterror) + controlled_exit(EXIT_BAD); + else + return (NULL); } else { val = wl->wl_word; wl = wl->wl_next; @@ -324,7 +330,10 @@ cp_setparse(wordlist *wl) } else { fprintf(cp_err, "Error: bad set form.\n"); tfree(name); /*DG: cp_unquote Memory leak: free name befor exiting */ - return (NULL); + if (ft_stricterror) + controlled_exit(EXIT_BAD); + else + return (NULL); } /* val = cp_unquote(val); DG: bad old val is lost*/ @@ -367,7 +376,10 @@ cp_setparse(wordlist *wl) if (balance && !wl) { fprintf(cp_err, "Error: bad set form.\n"); tfree(name); /* va: cp_unquote memory leak: free name before exiting */ - return (NULL); + if (ft_stricterror) + controlled_exit(EXIT_BAD); + else + return (NULL); } vv = alloc(struct variable);