Fixed memory leak in error handling.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1046 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
meep-eep
2003-07-10 00:27:57 +00:00
parent 9fe24d962c
commit 1dadf98653
+3 -1
View File
@@ -570,7 +570,7 @@ uio_getPathPhysicalDirs(uio_DirHandle *dirHandle, const char *path,
// ENOENT if some component didn't exist // ENOENT if some component didn't exist
// ENOTDIR is some component exists, but is not a dir // ENOTDIR is some component exists, but is not a dir
// something else (like EPATHTOOLONG) for internal errors // something else (like EPATHTOOLONG) for internal errors
// 'resolvedPath' will be set to the absolute path as returned by // On success, 'resolvedPath' will be set to the absolute path as returned by
// uio_resolvePath. // uio_resolvePath.
int int
uio_verifyPath(uio_DirHandle *dirHandle, const char *path, uio_verifyPath(uio_DirHandle *dirHandle, const char *path,
@@ -626,12 +626,14 @@ uio_verifyPath(uio_DirHandle *dirHandle, const char *path,
fprintf(stderr, "Warning: Unknown error from " fprintf(stderr, "Warning: Unknown error from "
"uio_walkPhysicalPath: %s\n", strerror(retVal)); "uio_walkPhysicalPath: %s\n", strerror(retVal));
#endif #endif
uio_free(*resolvedPath);
errno = retVal; errno = retVal;
return -1; return -1;
} }
} }
// No match, exit with ENOENT. // No match, exit with ENOENT.
uio_free(*resolvedPath);
errno = ENOENT; errno = ENOENT;
return -1; return -1;
} }