This commit is contained in:
Přemysl Eric Janouch 2021-12-13 17:39:15 +01:00
parent e161f77359
commit 9eb9cc44aa
Signed by: p
GPG Key ID: A0420B94F92B9493
2 changed files with 6 additions and 3 deletions

View File

@ -1283,19 +1283,22 @@ open_libwebp(const gchar *data, gsize len, const gchar *path, GError **error)
goto fail; goto fail;
} }
// Releasing the demux chunk iterator is actually a no-op.
WebPChunkIterator chunk_iter = {};
uint32_t flags = WebPDemuxGetI(demux, WEBP_FF_FORMAT_FLAGS); uint32_t flags = WebPDemuxGetI(demux, WEBP_FF_FORMAT_FLAGS);
WebPChunkIterator chunk_iter;
if ((flags & ICCP_FLAG) && if ((flags & ICCP_FLAG) &&
WebPDemuxGetChunk(demux, "ICCP", 1, &chunk_iter)) { WebPDemuxGetChunk(demux, "ICCP", 1, &chunk_iter)) {
cairo_surface_set_user_data(result, &fastiv_io_key_icc, cairo_surface_set_user_data(result, &fastiv_io_key_icc,
g_bytes_new(chunk_iter.chunk.bytes, chunk_iter.chunk.size), g_bytes_new(chunk_iter.chunk.bytes, chunk_iter.chunk.size),
(cairo_destroy_func_t) g_bytes_unref); (cairo_destroy_func_t) g_bytes_unref);
WebPDemuxReleaseChunkIterator(&chunk_iter);
} }
if ((flags & EXIF_FLAG) && if ((flags & EXIF_FLAG) &&
WebPDemuxGetChunk(demux, "EXIF", 1, &chunk_iter)) { WebPDemuxGetChunk(demux, "EXIF", 1, &chunk_iter)) {
cairo_surface_set_user_data(result, &fastiv_io_key_exif, cairo_surface_set_user_data(result, &fastiv_io_key_exif,
g_bytes_new(chunk_iter.chunk.bytes, chunk_iter.chunk.size), g_bytes_new(chunk_iter.chunk.bytes, chunk_iter.chunk.size),
(cairo_destroy_func_t) g_bytes_unref); (cairo_destroy_func_t) g_bytes_unref);
WebPDemuxReleaseChunkIterator(&chunk_iter);
} }
if (flags & ANIMATION_FLAG) { if (flags & ANIMATION_FLAG) {
cairo_surface_set_user_data(result, &fastiv_io_key_loops, cairo_surface_set_user_data(result, &fastiv_io_key_loops,
@ -1303,7 +1306,6 @@ open_libwebp(const gchar *data, gsize len, const gchar *path, GError **error)
NULL); NULL);
} }
WebPDemuxReleaseChunkIterator(&chunk_iter);
WebPDemuxDelete(demux); WebPDemuxDelete(demux);
fail: fail:

View File

@ -20,9 +20,10 @@
#include <jv.h> #include <jv.h>
#include <errno.h> #include <errno.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdbool.h>
// --- ICC profiles ------------------------------------------------------------ // --- ICC profiles ------------------------------------------------------------
// v2 https://www.color.org/ICC_Minor_Revision_for_Web.pdf // v2 https://www.color.org/ICC_Minor_Revision_for_Web.pdf