Browse Source

variable.c: add strict error handling

pre-master-46
h_vogt 14 years ago
parent
commit
d5a2a361f6
  1. 20
      src/frontend/variable.c

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

Loading…
Cancel
Save