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 423 - Potential memory leak in SDL_RWFromFile function
Summary: Potential memory leak in SDL_RWFromFile function
Status: RESOLVED INVALID
Alias: None
Product: SDL
Classification: Unclassified
Component: file (show other bugs)
Version: 1.2.11
Hardware: All All
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-21 11:58 UTC by Patrice Mandin
Modified: 2007-04-21 12:03 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Patrice Mandin 2007-04-21 11:58:55 UTC
Hello,

At the end of the function we got:
--8<--8<--
	if ( fp == NULL ) {
		SDL_SetError("Couldn't open %s", file);
	} else {
		rwops = SDL_RWFromFP(fp, 1);
	}
#else
	SDL_SetError("SDL not compiled with stdio support");
#endif /* !HAVE_STDIO_H */

	return(rwops);
--8<--8<--

In the if() statement, only an error message is set, but the rwops structure is not freed, and set to NULL, before being returned to the calling application.
Comment 1 Patrice Mandin 2007-04-21 12:03:39 UTC
Oops, sorry, did not read the whole function. The #ifdef stuff confused me.