Jelajahi Sumber

Don't leave garbage in output parameters

Sam Lantinga 1 bulan lalu
induk
melakukan
c663b6ec1f
1 mengubah file dengan 6 tambahan dan 0 penghapusan
  1. 6 0
      src/audio/SDL_audiocvt.c

+ 6 - 0
src/audio/SDL_audiocvt.c

@@ -531,6 +531,12 @@ bool SDL_UnlockAudioStream(SDL_AudioStream *stream)
 bool SDL_GetAudioStreamFormat(SDL_AudioStream *stream, SDL_AudioSpec *src_spec, SDL_AudioSpec *dst_spec)
 bool SDL_GetAudioStreamFormat(SDL_AudioStream *stream, SDL_AudioSpec *src_spec, SDL_AudioSpec *dst_spec)
 {
 {
     if (!stream) {
     if (!stream) {
+        if (src_spec) {
+            SDL_zerop(src_spec);
+        }
+        if (dst_spec) {
+            SDL_zerop(dst_spec);
+        }
         return SDL_InvalidParamError("stream");
         return SDL_InvalidParamError("stream");
     }
     }