summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Torri <vincent dot torri at gmail dot com>2015-10-14 10:17:00 +0200
committerTom Hacohen <tom@stosb.com>2015-10-14 09:44:48 +0100
commitd8008f4625fd48fde2df24f98fe4cd54f1fb3b9b (patch)
tree24155a22b9ec735d2ec8348a5914fa7180670d09
parent8854b9f72773f5b5a215d2e1477d064b647e34e9 (diff)
Eina: fix memory leak in eina_file_open()
@fix
-rw-r--r--src/lib/eina/eina_file_win32.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/src/lib/eina/eina_file_win32.c b/src/lib/eina/eina_file_win32.c
index a1371d73f7..2df5956420 100644
--- a/src/lib/eina/eina_file_win32.c
+++ b/src/lib/eina/eina_file_win32.c
@@ -733,30 +733,16 @@ eina_file_open(const char *path, Eina_Bool shared)
733 733
734 if (handle == INVALID_HANDLE_VALUE) 734 if (handle == INVALID_HANDLE_VALUE)
735 { 735 {
736 LPVOID lpMsgBuf; 736 char *msg;
737 737
738 FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | 738 msg = evil_last_error_get();
739 FORMAT_MESSAGE_FROM_SYSTEM | 739 if (msg)
740 FORMAT_MESSAGE_IGNORE_INSERTS,
741 NULL,
742 GetLastError(),
743 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
744 (LPTSTR) &lpMsgBuf,
745 0, NULL);
746
747 switch (GetLastError())
748 { 740 {
749 case ERROR_FILE_NOT_FOUND: 741 WRN("eina_file_open() failed with file %s: %s", filename, msg);
750 WRN("Could not open file [%s].", filename); 742 free(msg);
751 free(filename);
752 return NULL;
753 case ERROR_PATH_NOT_FOUND:
754 WRN("Could not find file path [%s].", filename);
755 free(filename);
756 return NULL;
757 default:
758 goto free_file;
759 } 743 }
744 else
745 goto free_file;
760 } 746 }
761 747
762 if (!GetFileAttributesEx(filename, GetFileExInfoStandard, &fad)) 748 if (!GetFileAttributesEx(filename, GetFileExInfoStandard, &fad))