AP_HAL_Linux: fix memory leaks

Fixes #8642
This commit is contained in:
Hyungsub 2018-06-15 13:08:38 +10:00 committed by Francisco Ferreira
parent 8ae2729022
commit 97b93920b3
1 changed files with 2 additions and 0 deletions

View File

@ -23,6 +23,7 @@ static void BM_Crop8bpp(benchmark::State& state)
new_buffer = (uint8_t *)malloc(state.range_x() * state.range_y()); new_buffer = (uint8_t *)malloc(state.range_x() * state.range_y());
if (!new_buffer) { if (!new_buffer) {
fprintf(stderr, "error: couldn't malloc new_buffer\n"); fprintf(stderr, "error: couldn't malloc new_buffer\n");
free(buffer);
return; return;
} }
@ -50,6 +51,7 @@ static void BM_YuyvToGrey(benchmark::State& state)
new_buffer = (uint8_t *)malloc(state.range_x() / 2); new_buffer = (uint8_t *)malloc(state.range_x() / 2);
if (!new_buffer) { if (!new_buffer) {
fprintf(stderr, "error: couldn't malloc new_buffer\n"); fprintf(stderr, "error: couldn't malloc new_buffer\n");
free(buffer);
return; return;
} }