Skip to content

Commit

Permalink
clean up styling
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Jan 31, 2012
1 parent 4cfb7a6 commit 323e24b
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/Image.cc
Original file line number Diff line number Diff line change
Expand Up @@ -613,17 +613,18 @@ Image::loadJPEGFromBuffer(uint8_t *buf, unsigned len) {
// Data alloc
int stride = width * 4;
uint8_t *data = (uint8_t *) malloc(width * height * 4);

if (!data) {
jpeg_finish_decompress(&info);
jpeg_destroy_decompress(&info);
return CAIRO_STATUS_NO_MEMORY;
jpeg_finish_decompress(&info);
jpeg_destroy_decompress(&info);
return CAIRO_STATUS_NO_MEMORY;
}

uint8_t *src = (uint8_t *) malloc(width * 3);
if (!src) {
free(data);
jpeg_finish_decompress(&info);
jpeg_destroy_decompress(&info);
jpeg_finish_decompress(&info);
jpeg_destroy_decompress(&info);
return CAIRO_STATUS_NO_MEMORY;
}

Expand Down Expand Up @@ -683,19 +684,21 @@ Image::loadJPEG(FILE *stream) {
// Data alloc
int stride = width * 4;
uint8_t *data = (uint8_t *) malloc(width * height * 4);

if (!data) {
fclose(stream);
jpeg_finish_decompress(&info);
jpeg_destroy_decompress(&info);
return CAIRO_STATUS_NO_MEMORY;
fclose(stream);
jpeg_finish_decompress(&info);
jpeg_destroy_decompress(&info);
return CAIRO_STATUS_NO_MEMORY;
}

uint8_t *src = (uint8_t *) malloc(width * 3);

if (!src) {
free(data);
fclose(stream);
jpeg_finish_decompress(&info);
jpeg_destroy_decompress(&info);
fclose(stream);
jpeg_finish_decompress(&info);
jpeg_destroy_decompress(&info);
return CAIRO_STATUS_NO_MEMORY;
}

Expand Down

0 comments on commit 323e24b

Please sign in to comment.