--- a\srcmatrixex\iupmatex_clipboard.c	Tue Jan 16 14:58:55 2018
+++ b\srcmatrixex\iupmatex_clipboard.c	Tue Jan 16 15:00:25 2018
@@ -702,13 +702,6 @@
   char* data, *paste_at;
   int lin = 0, col = 0;
 
-  data = iMatrixReadFile(value);
-  if (!data)
-  {
-    iupAttribSet(ih, "LASTERROR", "IUP_ERRORFILEOPEN");
-    return 0;
-  }
-
   paste_at = iupAttribGet(ih, "PASTEFILEAT");
   if (paste_at)
   {
@@ -718,10 +711,16 @@
     {
       if (iupStrToIntInt(paste_at, &lin, &col, ':') != 2)
       {
-        free(data);
         return 0;
       }
     }
+  }
+
+  data = iMatrixReadFile(value);
+  if (!data)
+  {
+    iupAttribSet(ih, "LASTERROR", "IUP_ERRORFILEOPEN");
+    return 0;
   }
 
   iMatrixExPasteData(ih, data, lin, col, "PASTEFILE");
