Skip to content

Commit

Permalink
esp32_apptrace: Fixes allocation of free data block in sync data proc…
Browse files Browse the repository at this point in the history
…essing mode
  • Loading branch information
gerekon committed May 25, 2018
1 parent 46c1b70 commit 370c35e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/target/esp108_apptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -886,13 +886,13 @@ static int esp_apptrace_cmd_ctx_init(struct target *target, struct esp_apptrace_

cmd_ctx->running = 1;

res = pthread_mutex_init(&cmd_ctx->trax_blocks_mux, NULL);
if (res) {
LOG_ERROR("Failed to blocks pool mux (%d)!", res);
esp_apptrace_blocks_pool_cleanup(cmd_ctx);
return ERROR_FAIL;
}
if (cmd_ctx->mode != ESP_APPTRACE_CMD_MODE_SYNC) {
res = pthread_mutex_init(&cmd_ctx->trax_blocks_mux, NULL);
if (res) {
LOG_ERROR("Failed to blocks pool mux (%d)!", res);
esp_apptrace_blocks_pool_cleanup(cmd_ctx);
return ERROR_FAIL;
}
res = pthread_create(&cmd_ctx->data_processor, NULL, esp_apptrace_data_processor, cmd_ctx);
if (res) {
LOG_ERROR("Failed to start trace data processor thread (%d)!", res);
Expand Down Expand Up @@ -927,8 +927,8 @@ static int esp_apptrace_cmd_ctx_cleanup(struct esp_apptrace_cmd_ctx *cmd_ctx)
else {
LOG_INFO("Trace data processor thread exited with %ld", (long)thr_res);
}
pthread_mutex_destroy(&cmd_ctx->trax_blocks_mux);
}
pthread_mutex_destroy(&cmd_ctx->trax_blocks_mux);
esp_apptrace_blocks_pool_cleanup(cmd_ctx);
return ERROR_OK;
}
Expand Down

0 comments on commit 370c35e

Please sign in to comment.