variable.c: add strict error handling

This commit is contained in:
h_vogt 2012-11-04 14:16:27 +01:00
parent 85244d0222
commit d5a2a361f6
1 changed files with 16 additions and 4 deletions

View File

@ -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);