Skip to content

Commit

Permalink
refactor: memory allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
kjdev committed Mar 31, 2024
1 parent c017e6d commit 8883219
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/ngx_keyval.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ ngx_keyval_conf_set_variable(ngx_conf_t *cf, ngx_command_t *cmd, void *conf,
return "failed to allocate memory for intermediate string";
}

variable_name = ngx_alloc(size_buffer_variable_name, cf->log);
variable_name = ngx_pnalloc(cf->pool, size_buffer_variable_name);
if (variable_name == NULL) {
return "failed to allocate memory for variable name buffer";
}
Expand Down Expand Up @@ -568,8 +568,6 @@ ngx_keyval_conf_set_variable(ngx_conf_t *cf, ngx_command_t *cmd, void *conf,
(*var)->key_string.data[final_pos] = '\0';
}

ngx_free(variable_name);

(*var)->variable = value[2];

(*var)->zone = ngx_keyval_conf_zone_get(cf, cmd, config, &value[3]);
Expand Down

0 comments on commit 8883219

Please sign in to comment.