diff options
author | Guy Harris <guy@alum.mit.edu> | 2019-06-16 12:02:00 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-16 12:02:00 -0700 |
commit | ebaafda0b638fd8293f6cbfe41f86abb0da22edc (patch) | |
tree | 48d2121991b0c15e313f322dc69fa33d225c3510 | |
parent | 2e9d0ae34ece4d6f67f4d66a4c3628febf0b13dd (diff) | |
parent | 643d780ef5b49e120bedae58f8827e733a18682b (diff) |
Merge pull request #826 from catenacyber/doublefree
Fixes double free in opt_cleanup
-rw-r--r-- | optimize.c | 15 |
1 files changed, 0 insertions, 15 deletions
@@ -2182,7 +2182,6 @@ opt_init(opt_state_t *opt_state, struct icode *ic) opt_state->n_edges = 2 * opt_state->n_blocks; opt_state->edges = (struct edge **)calloc(opt_state->n_edges, sizeof(*opt_state->edges)); if (opt_state->edges == NULL) { - free(opt_state->blocks); opt_error(opt_state, "malloc"); } @@ -2191,8 +2190,6 @@ opt_init(opt_state_t *opt_state, struct icode *ic) */ opt_state->levels = (struct block **)calloc(opt_state->n_blocks, sizeof(*opt_state->levels)); if (opt_state->levels == NULL) { - free(opt_state->edges); - free(opt_state->blocks); opt_error(opt_state, "malloc"); } @@ -2203,9 +2200,6 @@ opt_init(opt_state_t *opt_state, struct icode *ic) opt_state->space = (bpf_u_int32 *)malloc(2 * opt_state->n_blocks * opt_state->nodewords * sizeof(*opt_state->space) + opt_state->n_edges * opt_state->edgewords * sizeof(*opt_state->space)); if (opt_state->space == NULL) { - free(opt_state->levels); - free(opt_state->edges); - free(opt_state->blocks); opt_error(opt_state, "malloc"); } p = opt_state->space; @@ -2245,19 +2239,10 @@ opt_init(opt_state_t *opt_state, struct icode *ic) opt_state->maxval = 3 * max_stmts; opt_state->vmap = (struct vmapinfo *)calloc(opt_state->maxval, sizeof(*opt_state->vmap)); if (opt_state->vmap == NULL) { - free(opt_state->space); - free(opt_state->levels); - free(opt_state->edges); - free(opt_state->blocks); opt_error(opt_state, "malloc"); } opt_state->vnode_base = (struct valnode *)calloc(opt_state->maxval, sizeof(*opt_state->vnode_base)); if (opt_state->vnode_base == NULL) { - free(opt_state->vmap); - free(opt_state->space); - free(opt_state->levels); - free(opt_state->edges); - free(opt_state->blocks); opt_error(opt_state, "malloc"); } } |