1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-15 07:43:50 +00:00

1. Fixed typo

2. Added handler for jpeg memory allocation error
This commit is contained in:
Bryan Roe
2020-07-27 09:59:07 -07:00
parent 453b5cdf5b
commit 9c3fa12dc6
2 changed files with 5 additions and 4 deletions

View File

@@ -15,6 +15,7 @@ limitations under the License.
*/
#include "linux_compression.h"
#include "../../../microstack/ILibParsers.h";
#if defined(JPEGMAXBUF)
#define MAX_TILE_SIZE JPEGMAXBUF
@@ -40,7 +41,7 @@ void init_destination(j_compress_ptr cinfo)
{
JOCTET * next_output_byte;
if (jpeg_buffer != NULL) { free(jpeg_buffer); }
jpeg_buffer = malloc(MAX_BUFFER);
if ((jpeg_buffer = malloc(MAX_BUFFER)) == NULL) { ILIBCRITICALEXIT(254); }
jpeg_buffer_length = 0;
next_output_byte = jpeg_buffer;
cinfo->dest->next_output_byte = next_output_byte;
@@ -52,7 +53,7 @@ boolean empty_output_buffer(j_compress_ptr cinfo)
JOCTET * next_output_byte;
jpeg_buffer_length += MAX_BUFFER;
jpeg_buffer = (unsigned char *) realloc(jpeg_buffer, jpeg_buffer_length + MAX_BUFFER);
if ((jpeg_buffer = (unsigned char *)realloc(jpeg_buffer, jpeg_buffer_length + MAX_BUFFER)) == NULL) { ILIBCRITICALEXIT(254); }
next_output_byte = jpeg_buffer + jpeg_buffer_length;
cinfo->dest->next_output_byte = next_output_byte;
cinfo->dest->free_in_buffer = MAX_BUFFER;
@@ -78,7 +79,7 @@ void term_destination (j_compress_ptr cinfo)
else
#endif
{
jpeg_buffer = (unsigned char *) realloc(jpeg_buffer, jpeg_buffer_length);
if ((jpeg_buffer = (unsigned char *)realloc(jpeg_buffer, jpeg_buffer_length)) == NULL) { ILIBCRITICALEXIT(254); }
}
}