mackron / dr_libs

Audio decoding libraries for C/C++, each in a single source file.
Other
1.24k stars 205 forks source link

dr_mp3: potentially unnecessary null-check (flagged by Coverity) #126

Closed kcgen closed 4 years ago

kcgen commented 4 years ago

The check of "pConfig" in both places suggests that it could be be null, but it has already been dereferenced on all paths leading to both checks:

4100 if (pConfig != NULL) {
4101 pConfig->channels = pMP3->channels;
4102 pConfig->sampleRate = pMP3->sampleRate;
4103 }

and

4170 if (pConfig != NULL) {
4171 pConfig->channels = pMP3->channels;
4172 pConfig->sampleRate = pMP3->sampleRate;
4173 }
4174 
4175 drmp3_uninit(pMP3);
mackron commented 4 years ago

Legitimate bug. Fixed in the dev branch: https://github.com/mackron/dr_libs/commit/95c30e919456082fc636e5c36f7b251a511d47a8