However the bigger issue is that PaPulseAudio_UnLock is not called consistently. Either PaPulseAudio_UnLock needs to be called before or after goto error but not both or neither. On line 563 it gets locked, but there is also a goto error prior to that on line 550. Some later goto error paths unlock, some don't.
One possible fix is to have an error_unlock: label prior to the error label that is used for paths that should unlock.
This PR fixes an access-after free when calling
PaPulseAudio_UnLock
https://github.com/PortAudio/portaudio/pull/847
However the bigger issue is that
PaPulseAudio_UnLock
is not called consistently. EitherPaPulseAudio_UnLock
needs to be called before or aftergoto error
but not both or neither. On line 563 it gets locked, but there is also agoto error
prior to that on line 550. Some latergoto error
paths unlock, some don't.One possible fix is to have an
error_unlock:
label prior to theerror
label that is used for paths that should unlock.