diff --git a/engine/shared/library/sharedFoundation/src/linux/Os.cpp b/engine/shared/library/sharedFoundation/src/linux/Os.cpp index e9f2b621..689957f3 100644 --- a/engine/shared/library/sharedFoundation/src/linux/Os.cpp +++ b/engine/shared/library/sharedFoundation/src/linux/Os.cpp @@ -349,8 +349,10 @@ bool Os::getAbsolutePath(const char *relativePath, char *absolutePath, int absol { // realpath sucks and could cause a buffer overrun. however, it's better than writing it ourselves for now. char *result = realpath(relativePath, absolutePath); - if (!result) + if (!result){ + free(result); return false; + } FATAL(istrlen(absolutePath)+1 > absolutePathBufferSize, ("buffer overrun")); return true; diff --git a/engine/shared/library/sharedFoundation/src/linux/Os.h b/engine/shared/library/sharedFoundation/src/linux/Os.h index 44778b4e..972a93b7 100644 --- a/engine/shared/library/sharedFoundation/src/linux/Os.h +++ b/engine/shared/library/sharedFoundation/src/linux/Os.h @@ -27,7 +27,11 @@ public: enum { +#ifdef PATH_MAX + MAX_PATH_LENGTH = PATH_MAX+1 +#else MAX_PATH_LENGTH = 512 +#endif }; typedef void (*QueueCharacterHookFunction)(int keyboard, int character);