Skip to content

Commit

Permalink
Free resources in the reverse order of allocation (#237)
Browse files Browse the repository at this point in the history
When resources are freed in the reverse order as they are allocated,
it simplifies when you want to disable parts of the code when hunting for
memory leaks and undefined behavior.
  • Loading branch information
killenheladagen authored Apr 24, 2024
1 parent e83ab74 commit 8310d75
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/dockerdwrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,8 @@ int main(int argc, char** argv) {

stop_dockerd();
}
main_loop_unref();

sd_disk_storage_free(sd_disk_storage);

fcgi_stop();

Expand All @@ -858,9 +859,10 @@ int main(int argc, char** argv) {
ax_parameter_free(app_state.param_handle);
}

sd_disk_storage_free(sd_disk_storage);
free(app_state.sd_card_area);

main_loop_unref();

log_debug("Application exited with exit code %d", application_exit_code);
return application_exit_code;
}

0 comments on commit 8310d75

Please sign in to comment.