Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed bugs 1914, 1915 - sizeof(const char**) is suspicious
Nitz
In function:
static void add_music_decoder(const char *decoder)
{
void *ptr = SDL_realloc(music_decoders, (num_decoders + 1) * sizeof (const char **));
if (ptr == NULL) {
return; /* oh well, go on without it. */
}
music_decoders = (const char **) ptr;
music_decoders[num_decoders++] = decoder;
}
Passing argument sizeof(char const **) to function SDL_realloc is suspicious.
Logically it should be sizeof(char const *) instead of sizeof (char const **)
In this particular case sizeof(char const **) happens to be equal to sizeof(char const *), but this is not a portable assumption.
It reduces the understanding of the user.
So Patch should be,
void *ptr=SDL_realloc(music_decoders,(num_decoders+1) * sizeof(const char *));- Loading branch information