| Summary: | Remove NULL check in IMG_LoadTGA_RW function | ||
|---|---|---|---|
| Product: | SDL_image | Reporter: | Nitz <nitin.j4> |
| Component: | misc | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED WONTFIX | QA Contact: | Sam Lantinga <slouken> |
| Severity: | major | ||
| Priority: | P2 | ||
| Version: | unspecified | ||
| Hardware: | x86 | ||
| OS: | Linux | ||
| Attachments: | Patch is attached to remove extra NULL check for img | ||
Created attachment 2138 [details]
Patch is attached to remove extra NULL check for img
This is useful in case anybody adds any additional error conditions in the function. It's not performance critical code so an extra conditional isn't a problem here. Thanks for the analysis! |
In IMG_LoadTGA_RW function: if(img == NULL) { error = "Out of memory"; goto error; } error: SDL_RWseek(src, start, RW_SEEK_SET); if ( img ) { SDL_FreeSurface(img); } IMG_SetError("%s", error); return NULL; Here again NULL check is applied for img, which is not required as its already checked. So its better to remove this extra code. Patch is attached.