Fix some issues caught by check_stdlib_usage.py

This commit is contained in:
Sam Lantinga
2023-06-27 06:18:45 -07:00
parent e8d2ccbc1c
commit c065a9b128
15 changed files with 41 additions and 39 deletions

View File

@@ -622,7 +622,7 @@ static int ALSA_OpenDevice(SDL_AudioDevice *_this, const char *devname)
_this->hidden->swizzle_func = no_swizzle;
}
}
free(chmap);
free(chmap); /* This should NOT be SDL_free() */
}
#endif /* SND_CHMAP_API_VERSION */
@@ -743,7 +743,7 @@ static void add_device(const int iscapture, const char *name, void *hint, ALSA_D
handle = SDL_strdup(name);
if (handle == NULL) {
if (hint) {
free(desc);
free(desc); /* This should NOT be SDL_free() */
}
SDL_free(dev);
return;
@@ -755,7 +755,7 @@ static void add_device(const int iscapture, const char *name, void *hint, ALSA_D
*/
SDL_AddAudioDevice(iscapture, desc, NULL, handle);
if (hint) {
free(desc);
free(desc); /* This should NOT be SDL_free() */
}
dev->name = handle;
dev->iscapture = iscapture;
@@ -814,7 +814,7 @@ static void ALSA_HotplugIteration(void)
}
}
free(name);
free(name); /* This should NOT be SDL_free() */
}
/* look through the list of device names to find matches */
@@ -839,10 +839,10 @@ static void ALSA_HotplugIteration(void)
SDL_bool have_output = SDL_FALSE;
SDL_bool have_input = SDL_FALSE;
free(ioid);
free(ioid); /* This should NOT be SDL_free() */
if (!isoutput && !isinput) {
free(name);
free(name); /* This should NOT be SDL_free() */
continue;
}
@@ -876,7 +876,7 @@ static void ALSA_HotplugIteration(void)
}
}
free(name);
free(name); /* This should NOT be SDL_free() */
}
ALSA_snd_device_name_free_hint(hints);