[rcore][desktop] Fix clipboard image memory leak (#5968)
* [rcore][desktop] Fix clipboard image memory leak * [delete] delete comment GetClipboardImage into NOTE about where put SDL_free() .
This commit is contained in:
parent
f00317bead
commit
fb4649a3fe
1 changed files with 3 additions and 1 deletions
|
|
@ -1255,12 +1255,14 @@ Image GetClipboardImage(void)
|
||||||
|
|
||||||
for (int i = 0; i < SDL_arraysize(imageFormats); i++)
|
for (int i = 0; i < SDL_arraysize(imageFormats); i++)
|
||||||
{
|
{
|
||||||
// NOTE: This pointer should be free with SDL_free() at some point
|
|
||||||
fileData = SDL_GetClipboardData(imageFormats[i], &dataSize);
|
fileData = SDL_GetClipboardData(imageFormats[i], &dataSize);
|
||||||
|
|
||||||
if (fileData)
|
if (fileData)
|
||||||
{
|
{
|
||||||
image = LoadImageFromMemory(imageExtensions[i], fileData, (int)dataSize);
|
image = LoadImageFromMemory(imageExtensions[i], fileData, (int)dataSize);
|
||||||
|
|
||||||
|
SDL_free(fileData);
|
||||||
|
|
||||||
if (IsImageValid(image))
|
if (IsImageValid(image))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_INFO, "Clipboard: Got image from clipboard successfully: %s", imageExtensions[i]);
|
TRACELOG(LOG_INFO, "Clipboard: Got image from clipboard successfully: %s", imageExtensions[i]);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue