mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-01 19:42:07 +08:00
camerad: fix memory leak in create_thumbnail (#2743)
* fix memory leak in create_thumbnail * free memory returned from jpeg_mem_dest * OMG old-commit-hash: f0d240a7e3d1a91a3d0bac1cc9050c531105d87d
This commit is contained in:
@@ -296,8 +296,9 @@ void create_thumbnail(MultiCameraState *s, CameraState *c, uint8_t *bgr_ptr) {
|
||||
row_pointer[0] = row;
|
||||
jpeg_write_scanlines(&cinfo, row_pointer, 1);
|
||||
}
|
||||
free(row);
|
||||
jpeg_finish_compress(&cinfo);
|
||||
jpeg_destroy_compress(&cinfo);
|
||||
free(row);
|
||||
|
||||
MessageBuilder msg;
|
||||
auto thumbnaild = msg.initEvent().initThumbnail();
|
||||
@@ -308,6 +309,7 @@ void create_thumbnail(MultiCameraState *s, CameraState *c, uint8_t *bgr_ptr) {
|
||||
if (s->pm != NULL) {
|
||||
s->pm->send("thumbnail", msg);
|
||||
}
|
||||
free(thumbnail_buffer);
|
||||
}
|
||||
|
||||
void set_exposure_target(CameraState *c, const uint8_t *pix_ptr, int x_start, int x_end, int x_skip, int y_start, int y_end, int y_skip) {
|
||||
|
||||
Reference in New Issue
Block a user