tasn pushed a commit to branch master.
http://git.enlightenment.org/core/efl.git/commit/?id=d8008f4625fd48fde2df24f98fe4cd54f1fb3b9b
commit d8008f4625fd48fde2df24f98fe4cd54f1fb3b9b
Author: Vincent Torri <vincent dot torri at gmail dot com>
Date: Wed Oct 14 10:17:00 2015 +0200
Eina: fix memory leak in eina_file_open()
@fix
---
src/lib/eina/eina_file_win32.c | 30 ++++++++----------------------
1 file changed, 8 insertions(+), 22 deletions(-)
diff --git a/src/lib/eina/eina_file_win32.c b/src/lib/eina/eina_file_win32.c
index a1371d7..2df5956 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)
if (handle == INVALID_HANDLE_VALUE)
{
- LPVOID lpMsgBuf;
-
- FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) &lpMsgBuf,
- 0, NULL);
-
- switch (GetLastError())
+ char *msg;
+
+ msg = evil_last_error_get();
+ if (msg)
{
- case ERROR_FILE_NOT_FOUND:
- WRN("Could not open file [%s].", filename);
- free(filename);
- return NULL;
- case ERROR_PATH_NOT_FOUND:
- WRN("Could not find file path [%s].", filename);
- free(filename);
- return NULL;
- default:
- goto free_file;
+ WRN("eina_file_open() failed with file %s: %s", filename, msg);
+ free(msg);
}
+ else
+ goto free_file;
}
if (!GetFileAttributesEx(filename, GetFileExInfoStandard, &fad))
--