We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1236 - CreateCGImageSourceFromRWops leaks
Summary: CreateCGImageSourceFromRWops leaks
Status: RESOLVED FIXED
Alias: None
Product: SDL_image
Classification: Unclassified
Component: misc (show other bugs)
Version: 1.2.10
Hardware: x86_64 Mac OS X 10.6
: P2 major
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-24 00:41 UTC by Mike
Modified: 2011-12-31 09:39 UTC (History)
0 users

See Also:


Attachments
Test program (1.65 KB, application/octet-stream)
2011-06-24 00:41 UTC, Mike
Details
valgrind logfile - on current (1.2.10) version (18.34 KB, text/plain)
2011-06-24 00:44 UTC, Mike
Details
valgrind logfile for patched libSDL_image (15.91 KB, text/plain)
2011-06-24 00:45 UTC, Mike
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike 2011-06-24 00:41:23 UTC
Created attachment 633 [details]
Test program

CGDataProviderRef must be cleaned after usage.

Here is a proposed patch:
{{{
diff -r b1c1ec3a8d49 IMG_ImageIO.c
--- a/IMG_ImageIO.c	Thu Apr 07 07:50:52 2011 -0700
+++ b/IMG_ImageIO.c	Fri Jun 24 13:45:18 2011 +0700
@@ -103,6 +103,7 @@
 	// Get the CGImageSourceRef.
 	// The dictionary can be NULL or contain hints to help ImageIO figure out the image type.
 	source_ref = CGImageSourceCreateWithDataProvider(data_provider, hints_and_options);
+	CGDataProviderRelease(data_provider);
 	return source_ref;
 }
 
}}}

Attached are test program and valgrind's logfiles
Comment 1 Mike 2011-06-24 00:44:42 UTC
Created attachment 634 [details]
valgrind logfile - on current (1.2.10) version
Comment 2 Mike 2011-06-24 00:45:23 UTC
Created attachment 635 [details]
valgrind logfile for patched libSDL_image
Comment 3 Sam Lantinga 2011-12-31 09:39:09 UTC
Fixed, thanks!
http://hg.libsdl.org/SDL_image/rev/ec183abd5996