Don't leak allocated memory when exporting GL structured data

This commit is contained in:
baldurk
2022-01-10 17:53:39 +00:00
parent a0d40073ce
commit 755d141840
@@ -5329,6 +5329,12 @@ bool WrappedOpenGL::Serialise_glTextureSubImage1DEXT(SerialiserType &ser, GLuint
AddResourceInitChunk(texture);
}
if(ser.IsReading() && IsStructuredExporting(m_State))
{
if(!UnpackBufBound)
FreeAlignedBuffer((byte *)pixels);
}
return true;
}
@@ -5556,6 +5562,12 @@ bool WrappedOpenGL::Serialise_glTextureSubImage2DEXT(SerialiserType &ser, GLuint
AddResourceInitChunk(texture);
}
if(ser.IsReading() && IsStructuredExporting(m_State))
{
if(!UnpackBufBound)
FreeAlignedBuffer((byte *)pixels);
}
return true;
}
@@ -5791,6 +5803,12 @@ bool WrappedOpenGL::Serialise_glTextureSubImage3DEXT(SerialiserType &ser, GLuint
AddResourceInitChunk(texture);
}
if(ser.IsReading() && IsStructuredExporting(m_State))
{
if(!UnpackBufBound)
FreeAlignedBuffer((byte *)pixels);
}
return true;
}
@@ -6010,6 +6028,12 @@ bool WrappedOpenGL::Serialise_glCompressedTextureSubImage1DEXT(SerialiserType &s
AddResourceInitChunk(texture);
}
if(ser.IsReading() && IsStructuredExporting(m_State))
{
if(!UnpackBufBound)
FreeAlignedBuffer((byte *)pixels);
}
return true;
}
@@ -6235,6 +6259,12 @@ bool WrappedOpenGL::Serialise_glCompressedTextureSubImage2DEXT(SerialiserType &s
AddResourceInitChunk(texture);
}
if(ser.IsReading() && IsStructuredExporting(m_State))
{
if(!UnpackBufBound)
FreeAlignedBuffer((byte *)pixels);
}
return true;
}
@@ -6469,6 +6499,12 @@ bool WrappedOpenGL::Serialise_glCompressedTextureSubImage3DEXT(
AddResourceInitChunk(texture);
}
if(ser.IsReading() && IsStructuredExporting(m_State))
{
if(!UnpackBufBound)
FreeAlignedBuffer((byte *)pixels);
}
return true;
}