Fixed free of uninitialized value.
authorArmin Novak <armin.novak@gmail.com>
Sun, 16 Nov 2014 15:01:08 +0000 (16:01 +0100)
committerArmin Novak <armin.novak@gmail.com>
Sun, 16 Nov 2014 15:01:08 +0000 (16:01 +0100)
channels/cliprdr/client/cliprdr_format.c

index 239a8ad..bdd100b 100644 (file)
@@ -152,6 +152,9 @@ void cliprdr_process_format_list(cliprdrPlugin* cliprdr, wStream* s, UINT32 data
                Stream_Rewind(s, dataLen);
 
                formats = (CLIPRDR_FORMAT*) malloc(sizeof(CLIPRDR_FORMAT) * formatList.numFormats);
+               if (!formats)
+                       return;
+
                formatList.formats = formats;
 
                while (dataLen)
@@ -186,7 +189,10 @@ void cliprdr_process_format_list(cliprdrPlugin* cliprdr, wStream* s, UINT32 data
                        context->ServerFormatList(context, &formatList);
 
                for (index = 0; index < formatList.numFormats; index++)
-                       free(formats[index].formatName);
+               {
+                       if (formats[index].formatName)
+                               free(formats[index].formatName);
+               }
 
                free(formats);
        }