mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 18:06:18 +03:00
Merge pull request #3 from radarhere/write-jpeg-com
Free comment when returning early
This commit is contained in:
commit
6ca08a4601
|
@ -1113,6 +1113,9 @@ PyImaging_JpegEncoderNew(PyObject *self, PyObject *args) {
|
|||
/* malloc check ok, length is from python parsearg */
|
||||
char *p = malloc(extra_size); // Freed in JpegEncode, Case 6
|
||||
if (!p) {
|
||||
if (comment) {
|
||||
free(comment);
|
||||
}
|
||||
return ImagingError_MemoryError();
|
||||
}
|
||||
memcpy(p, extra, extra_size);
|
||||
|
@ -1125,6 +1128,9 @@ PyImaging_JpegEncoderNew(PyObject *self, PyObject *args) {
|
|||
/* malloc check ok, length is from python parsearg */
|
||||
char *pp = malloc(rawExifLen); // Freed in JpegEncode, Case 6
|
||||
if (!pp) {
|
||||
if (comment) {
|
||||
free(comment);
|
||||
}
|
||||
if (extra) {
|
||||
free(extra);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user