Skip to content

Commit

Permalink
fixed two use after free (gcc14)
Browse files Browse the repository at this point in the history
  • Loading branch information
msmeissn committed Oct 12, 2024
1 parent e6af170 commit b443036
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions camlibs/spca50x/spca50x-sdram.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,8 @@ spca50x_get_avi (CameraPrivateLibrary * lib, uint8_t ** buf,

/* jpeg starts here */
if ((data - mybuf) + frame_size > size) {
free (mybuf);
GP_DEBUG("BAD: accessing more than we read (%u vs total %d)", (unsigned int)((data-mybuf)+frame_size), size);
free (mybuf);
return GP_ERROR_CORRUPTED_DATA;
}
ret = create_jpeg_from_data (avi, data, qIndex, frame_width,
Expand Down Expand Up @@ -493,9 +493,9 @@ spca50x_get_avi (CameraPrivateLibrary * lib, uint8_t ** buf,
put_dword (start_of_file + 4, total_frame_size);

free (mybuf);
*len = avi - start_of_file;
start_of_file = realloc (start_of_file, avi - start_of_file);
*buf = start_of_file;
*len = avi - start_of_file;
return (GP_OK);
}

Expand Down

0 comments on commit b443036

Please sign in to comment.