diff options
author | Philippe Antoine <contact@catenacyber.fr> | 2019-06-16 20:20:43 +0200 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2019-06-20 02:46:02 -0700 |
commit | 4c86c4eca3c1cae965764ce4321d501d511b2d15 (patch) | |
tree | c6c507eaa087dcb36d726b1bc560fcebc473eac9 /optimize.c | |
parent | de978afd02065649222988833063998b5e0dfc84 (diff) | |
download | libpcap-4c86c4eca3c1cae965764ce4321d501d511b2d15.tar.gz |
No free in opt_init, rather in opt_cleanup
(cherry picked from commit 35412e2a7f0e299f504608542730168fff022d66)
Diffstat (limited to 'optimize.c')
-rw-r--r-- | optimize.c | 30 |
1 files changed, 0 insertions, 30 deletions
@@ -2166,8 +2166,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_state->blocks = NULL; opt_error(opt_state, "malloc"); } @@ -2176,10 +2174,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_state->edges = NULL; - opt_state->blocks = NULL; opt_error(opt_state, "malloc"); } @@ -2190,12 +2184,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_state->levels = NULL; - opt_state->edges = NULL; - opt_state->blocks = NULL; opt_error(opt_state, "malloc"); } p = opt_state->space; @@ -2235,28 +2223,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_state->space = NULL; - opt_state->levels = NULL; - opt_state->edges = NULL; - opt_state->blocks = NULL; 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_state->vmap = NULL; - opt_state->space = NULL; - opt_state->levels = NULL; - opt_state->edges = NULL; - opt_state->blocks = NULL; opt_error(opt_state, "malloc"); } } |