mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-05-05 08:23:42 +03:00
Free comment when returning early
This commit is contained in:
parent
eddc9bdcec
commit
1d780081a6
|
@ -1113,6 +1113,9 @@ PyImaging_JpegEncoderNew(PyObject *self, PyObject *args) {
|
||||||
/* malloc check ok, length is from python parsearg */
|
/* malloc check ok, length is from python parsearg */
|
||||||
char *p = malloc(extra_size); // Freed in JpegEncode, Case 6
|
char *p = malloc(extra_size); // Freed in JpegEncode, Case 6
|
||||||
if (!p) {
|
if (!p) {
|
||||||
|
if (comment) {
|
||||||
|
free(comment);
|
||||||
|
}
|
||||||
return ImagingError_MemoryError();
|
return ImagingError_MemoryError();
|
||||||
}
|
}
|
||||||
memcpy(p, extra, extra_size);
|
memcpy(p, extra, extra_size);
|
||||||
|
@ -1125,6 +1128,9 @@ PyImaging_JpegEncoderNew(PyObject *self, PyObject *args) {
|
||||||
/* malloc check ok, length is from python parsearg */
|
/* malloc check ok, length is from python parsearg */
|
||||||
char *pp = malloc(rawExifLen); // Freed in JpegEncode, Case 6
|
char *pp = malloc(rawExifLen); // Freed in JpegEncode, Case 6
|
||||||
if (!pp) {
|
if (!pp) {
|
||||||
|
if (comment) {
|
||||||
|
free(comment);
|
||||||
|
}
|
||||||
if (extra) {
|
if (extra) {
|
||||||
free(extra);
|
free(extra);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user