Skip to content

Commit

Permalink
Always fill *buf
Browse files Browse the repository at this point in the history
It is an out parameter and callers might be tempted to free it no matter
what the main return value says.
  • Loading branch information
zmanuel authored and icculus committed Aug 6, 2023
1 parent 041cf9a commit 9150989
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/SDL12_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -8454,12 +8454,12 @@ SDL_LoadWAV_RW(SDL12_RWops *rwops12, int freerwops12,
SDL_RWops *rwops20 = RWops12to20(rwops12);
SDL_AudioSpec *retval = NULL;

*buf = NULL;

if (!rwops20) {
return NULL;
}

*buf = NULL;

/* SDL2's LoadWAV requires a seekable stream, but SDL 1.2 didn't,
so if the stream appears unseekable, try to load it into a
memory rwops that we _can_ seek in */
Expand Down

0 comments on commit 9150989

Please sign in to comment.