msvcrt: move error condition before memory allocation (found by Smatch).
Lionel Debroux
lionel_debroux at yahoo.fr
Mon Sep 24 06:35:19 CDT 2007
---
dlls/msvcrt/dir.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/dlls/msvcrt/dir.c b/dlls/msvcrt/dir.c
index bd42afe..6050251 100644
--- a/dlls/msvcrt/dir.c
+++ b/dlls/msvcrt/dir.c
@@ -804,6 +804,12 @@ char * CDECL _fullpath(char * absPath, const char* relPath, unsigned int size)
if (!relPath || !*relPath)
return _getcwd(absPath, size);
+ if (size < 4)
+ {
+ *MSVCRT__errno() = MSVCRT_ERANGE;
+ return NULL;
+ }
+
if (absPath == NULL)
{
buffer = MSVCRT_malloc(MAX_PATH);
@@ -813,12 +819,6 @@ char * CDECL _fullpath(char * absPath, const char* relPath, unsigned int size)
else
buffer = absPath;
- if (size < 4)
- {
- *MSVCRT__errno() = MSVCRT_ERANGE;
- return NULL;
- }
-
TRACE(":resolving relative path '%s'\n",relPath);
rc = GetFullPathNameA(relPath,size,buffer,&lastpart);
--
1.5.3.1
--------------070105000408040807030601--
More information about the wine-patches
mailing list