diff --git a/src/core/RagePhoto.c b/src/core/RagePhoto.c index 659a192..f3da886 100644 --- a/src/core/RagePhoto.c +++ b/src/core/RagePhoto.c @@ -1235,6 +1235,7 @@ bool ragephoto_setphotojpeg(ragephoto_t instance, const char *data, uint32_t siz else if (instance->data->jpeg) { free(instance->data->jpeg); instance->data->jpeg = NULL; + instance->data->jpegSize = 0; } if (bufferSize != 0) { diff --git a/src/core/RagePhoto.cpp b/src/core/RagePhoto.cpp index 5dbdd98..345836a 100644 --- a/src/core/RagePhoto.cpp +++ b/src/core/RagePhoto.cpp @@ -1231,6 +1231,7 @@ bool RagePhoto::setJpeg(const char *data, uint32_t size, uint32_t bufferSize) else if (m_data->jpeg) { free(m_data->jpeg); m_data->jpeg = nullptr; + m_data->jpegSize = 0; } if (bufferSize != 0) {