Christoph Mallon: Remove pointless if (x) before SDL_free(x)

This commit is contained in:
Sam Lantinga
2013-08-29 08:29:21 -07:00
parent 1d2c7796ae
commit f79fc33a39
63 changed files with 157 additions and 349 deletions

View File

@@ -449,10 +449,8 @@ SDL_LoadWAV_RW(SDL_RWops * src, int freesrc,
/* Read the audio data format chunk */
chunk.data = NULL;
do {
if (chunk.data != NULL) {
SDL_free(chunk.data);
chunk.data = NULL;
}
SDL_free(chunk.data);
chunk.data = NULL;
lenread = ReadChunk(src, &chunk);
if (lenread < 0) {
was_error = 1;
@@ -549,10 +547,8 @@ SDL_LoadWAV_RW(SDL_RWops * src, int freesrc,
/* Read the audio data chunk */
*audio_buf = NULL;
do {
if (*audio_buf != NULL) {
SDL_free(*audio_buf);
*audio_buf = NULL;
}
SDL_free(*audio_buf);
*audio_buf = NULL;
lenread = ReadChunk(src, &chunk);
if (lenread < 0) {
was_error = 1;
@@ -583,9 +579,7 @@ SDL_LoadWAV_RW(SDL_RWops * src, int freesrc,
*audio_len &= ~(samplesize - 1);
done:
if (format != NULL) {
SDL_free(format);
}
SDL_free(format);
if (src) {
if (freesrc) {
SDL_RWclose(src);
@@ -606,9 +600,7 @@ SDL_LoadWAV_RW(SDL_RWops * src, int freesrc,
void
SDL_FreeWAV(Uint8 * audio_buf)
{
if (audio_buf != NULL) {
SDL_free(audio_buf);
}
SDL_free(audio_buf);
}
static int