1
0
Fork 0

Silence Coverity issue in SDL_sound

Coverity finds use after free on value pointed by sample_list, but fails
to detect, that this is a global variable, that is being updated by
Sound_FreeSample before freeing any memory.

This code is obviously written with the purpose of freeing whole list,
so there's nothing unexpected here - this is definitely a false
positive finding.

We could mark this issue as false-positive in Coverity, but I think it's
better to avoid tripping it in the first place.
This commit is contained in:
Patryk Obara 2020-01-05 20:56:46 +01:00 committed by Patryk Obara
parent cc6cd3af00
commit 0d71bf0ea4

View file

@ -145,7 +145,10 @@ int Sound_Quit(void)
BAIL_IF_MACRO(!initialized, ERR_NOT_INITIALIZED, 0);
while (((volatile Sound_Sample *) sample_list) != NULL)
Sound_FreeSample(sample_list);
{
Sound_Sample *sample = sample_list;
Sound_FreeSample(sample); /* Updates sample_list. */
}
initialized = 0;