Skip to content

Fix C string memory leak in EXIF tag helpers#484

Open
kkato wants to merge 1 commit into
h2non:masterfrom
kkato:kkato/fix-exif-cstring-leak
Open

Fix C string memory leak in EXIF tag helpers#484
kkato wants to merge 1 commit into
h2non:masterfrom
kkato:kkato/fix-exif-cstring-leak

Conversation

@kkato

@kkato kkato commented Jul 15, 2026

Copy link
Copy Markdown

Why

vipsExifStringTag and vipsExifIntTag allocate a C string with C.CString(tag) but never free it, so every call leaks it on the C heap.

What

Free the C.CString allocation with defer C.free, like the other functions in this file do.

vipsExifStringTag and vipsExifIntTag allocated a C string via
C.CString(tag) but never freed it, leaking on the C heap on every call.
Metadata() reads ~50 EXIF fields through these helpers, so each processed
image leaks ~50 small allocations, growing the C heap unbounded over time.

Free the allocation with defer C.free, matching the pattern already used
by vipsWindowSize, vipsWatermark and vipsTransformICC.

Fixes h2non#483
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant