mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-29 17:23:40 +01:00
Avoid double-free in stereo mode
This commit is contained in:
1 parent
cc16eb8321
commit
f593d65833
1 file changed
+6
-1
@@ -1048,6 +1048,7 @@ void GLQueueRunner::PerformRenderPass(const GLRStep &step, bool first, bool last
|
||||
glUnmapBuffer(GL_UNIFORM_BUFFER);
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, 0);
|
||||
}
|
||||
delete[] c.uniformStereoMatrix4.mData; // We only playback once.
|
||||
} else {
|
||||
int loc = c.uniformStereoMatrix4.loc ? *c.uniformStereoMatrix4.loc : -1;
|
||||
if (c.uniformStereoMatrix4.name) {
|
||||
@@ -1060,8 +1061,12 @@ void GLQueueRunner::PerformRenderPass(const GLRStep &step, bool first, bool last
|
||||
glUniformMatrix4fv(loc, 1, false, c.uniformStereoMatrix4.mData + 16);
|
||||
}
|
||||
}
|
||||
if (GetVRFBOIndex() == 1 || GetVRPassesCount() == 1) {
|
||||
// Only delete the data if we're rendering the only or the second eye.
|
||||
// If we delete during the first eye, we get a use-after-free or double delete.
|
||||
delete[] c.uniformStereoMatrix4.mData;
|
||||
}
|
||||
}
|
||||
delete [] c.uniformStereoMatrix4.mData;
|
||||
CHECK_GL_ERROR_IF_DEBUG();
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user