| Summary: | [patch] Fix segfault in SDL_CreateWindowTexture() | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Martin Decky <martin> |
| Component: | video | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | HG 2.0 | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Attachments: |
Proposed patch
Fix local variable initialization and scope |
||
|
Description
Martin Decky
2011-02-12 12:28:00 UTC
Created attachment 566 [details]
Proposed patch
I fixed it slightly differently in this patch: http://hg.libsdl.org/SDL/rev/bad04e4710f6 Thanks! OK. But then you should probably add at least the patch which I am going to attach in a minute to make it really work. Created attachment 570 [details]
Fix local variable initialization and scope
(Oops, sorry, originally attached to a wrong bug ..)
Rationale: The local variable "renderer" needs to be initialized to NULL,
otherwise the code in the if (!data) { ... } branch might fail to actually
create a renderer (note the second for-loop guarded by (!renderer)).
Secondly, move the "renderer" variable scope into the branch to make sure that
the code actually uses data->renderer outside the branch (which holds the only
provably correct value in both cases).
Got it, thanks! |