comparison lwlib/lw_expr.c @ 425:67815606c5d9 3.0-beta2

Prevent NULL deref in lw_expr_destroy
author lost@l-w.ca
date Sun, 19 Sep 2010 10:27:47 -0600
parents a741d2e4869f
children d7d7e4dca3e7
comparison
equal deleted inserted replaced
424:6d87423a979b 425:67815606c5d9
89 } 89 }
90 90
91 void lw_expr_destroy(lw_expr_t E) 91 void lw_expr_destroy(lw_expr_t E)
92 { 92 {
93 struct lw_expr_opers *o; 93 struct lw_expr_opers *o;
94 if (!E)
95 return;
94 for (o = E -> operands; o; o = o -> next) 96 for (o = E -> operands; o; o = o -> next)
95 lw_expr_destroy(o -> p); 97 lw_expr_destroy(o -> p);
96 if (E -> type == lw_expr_type_var) 98 if (E -> type == lw_expr_type_var)
97 lw_free(E -> value2); 99 lw_free(E -> value2);
98 lw_free(E); 100 lw_free(E);