Skip to content

Commit

Permalink
eval_var_list: check malloc() return value for NULL.
Browse files Browse the repository at this point in the history
  • Loading branch information
tcort committed May 18, 2015
1 parent ac3e551 commit 9aa143c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion var_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,12 @@ void eval_var_list(struct var_list *vl, char *line) {

len = strlen("LET X = ") + strlen(line) + 8;
let = (char *) malloc(len*sizeof(char));
if (let == NULL) {
perror("malloc");
exit(EXIT_FAILURE);
}

for (cur = vl; cur; cur = cur->list) {
for (cur = vl; cur != NULL; cur = cur->list) {
char *s;
struct var *v;
v = cur->var;
Expand Down

0 comments on commit 9aa143c

Please sign in to comment.