@@ -1699,6 +1699,8 @@ static bool GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SD
1699
1699
} else {
1700
1700
renderdata -> glGenTextures (1 , & data -> texture_v );
1701
1701
if (!GL_CheckError ("glGenTexures()" , renderer )) {
1702
+ SDL_free (data -> pixel_data );
1703
+ SDL_free (data );
1702
1704
return false;
1703
1705
}
1704
1706
}
@@ -1713,18 +1715,24 @@ static bool GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SD
1713
1715
} else {
1714
1716
renderdata -> glGenTextures (1 , & data -> texture_u );
1715
1717
if (!GL_CheckError ("glGenTexures()" , renderer )) {
1718
+ SDL_free (data -> pixel_data );
1719
+ SDL_free (data );
1716
1720
return false;
1717
1721
}
1718
1722
}
1719
1723
renderdata -> glActiveTexture (GL_TEXTURE1 );
1720
1724
renderdata -> glBindTexture (data -> texture_type , data -> texture_u );
1721
1725
renderdata -> glTexImage2D (data -> texture_type , 0 , format , (texture -> w + 1 ) / 2 , (texture -> h + 1 ) / 2 , 0 , format , type , NULL );
1722
1726
if (!GL_CheckError ("glTexImage2D()" , renderer )) {
1727
+ SDL_free (data -> pixel_data );
1728
+ SDL_free (data );
1723
1729
return false;
1724
1730
}
1725
1731
SDL_SetNumberProperty (SDL_GetTextureProperties (texture ), SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER , data -> texture_u );
1726
1732
1727
1733
if (!SDL_GetYCbCRtoRGBConversionMatrix (texture -> colorspace , texture -> w , texture -> h , 8 )) {
1734
+ SDL_free (data -> pixel_data );
1735
+ SDL_free (data );
1728
1736
return SDL_SetError ("Unsupported YUV colorspace" );
1729
1737
}
1730
1738
} else if (data -> nv12 ) {
@@ -1734,18 +1742,24 @@ static bool GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SD
1734
1742
} else {
1735
1743
renderdata -> glGenTextures (1 , & data -> texture_u );
1736
1744
if (!GL_CheckError ("glGenTexures()" , renderer )) {
1745
+ SDL_free (data -> pixel_data );
1746
+ SDL_free (data );
1737
1747
return false;
1738
1748
}
1739
1749
}
1740
1750
renderdata -> glActiveTexture (GL_TEXTURE1 );
1741
1751
renderdata -> glBindTexture (data -> texture_type , data -> texture_u );
1742
1752
renderdata -> glTexImage2D (data -> texture_type , 0 , GL_LUMINANCE_ALPHA , (texture -> w + 1 ) / 2 , (texture -> h + 1 ) / 2 , 0 , GL_LUMINANCE_ALPHA , GL_UNSIGNED_BYTE , NULL );
1743
1753
if (!GL_CheckError ("glTexImage2D()" , renderer )) {
1754
+ SDL_free (data -> pixel_data );
1755
+ SDL_free (data );
1744
1756
return false;
1745
1757
}
1746
1758
SDL_SetNumberProperty (SDL_GetTextureProperties (texture ), SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER , data -> texture_u );
1747
1759
1748
1760
if (!SDL_GetYCbCRtoRGBConversionMatrix (texture -> colorspace , texture -> w , texture -> h , 8 )) {
1761
+ SDL_free (data -> pixel_data );
1762
+ SDL_free (data );
1749
1763
return SDL_SetError ("Unsupported YUV colorspace" );
1750
1764
}
1751
1765
}
@@ -1757,6 +1771,8 @@ static bool GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SD
1757
1771
} else {
1758
1772
renderdata -> glGenTextures (1 , & data -> texture );
1759
1773
if (!GL_CheckError ("glGenTexures()" , renderer )) {
1774
+ SDL_free (data -> pixel_data );
1775
+ SDL_free (data );
1760
1776
return false;
1761
1777
}
1762
1778
}
0 commit comments