Fixed memory leak.
authorArmin Novak <armin.novak@gmail.com>
Sun, 16 Nov 2014 23:26:33 +0000 (00:26 +0100)
committerArmin Novak <armin.novak@gmail.com>
Sun, 16 Nov 2014 23:26:33 +0000 (00:26 +0100)
client/X11/xf_cliprdr.c

index 7b5aa6c..d25d758 100644 (file)
@@ -317,6 +317,8 @@ static void xf_cliprdr_process_requested_data(xfClipboard* clipboard, BOOL hasDa
        CopyMemory(pSrcData, data, SrcSize);
 
        bSuccess = ClipboardSetData(clipboard->system, formatId, (void*) pSrcData, SrcSize);
+       if (!bSuccess)
+               free (pSrcData);
 
        pFormatIds = NULL;
        count = ClipboardGetFormatIds(clipboard->system, &pFormatIds);
@@ -992,6 +994,8 @@ static int xf_cliprdr_server_format_data_response(CliprdrClientContext* context,
        CopyMemory(pSrcData, data, SrcSize);
 
        bSuccess = ClipboardSetData(clipboard->system, formatId, (void*) pSrcData, SrcSize);
+       if (!bSuccess)
+               free (pSrcData);
 
        if (bSuccess && altFormatId)
        {