Skip to content

Commit 25c7b5a

Browse files
committed
Fix memory allocation issue
1 parent a207a4f commit 25c7b5a

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

pxr/base/arch/darwin.mm

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@
77

88
#include "pxr/base/arch/darwin.h"
99
#import <Foundation/Foundation.h>
10-
#include <string>
1110

1211
PXR_NAMESPACE_OPEN_SCOPE
1312

1413

1514
const char* Arch_DarwinGetTemporaryDirectory() {
16-
std::string tmpDir = [NSTemporaryDirectory() UTF8String];
17-
return tmpDir.c_str();
15+
return [NSTemporaryDirectory() UTF8String];
1816
}
1917

2018
PXR_NAMESPACE_CLOSE_SCOPE

pxr/base/arch/fileSystem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ Arch_InitTmpDir()
736736
_TmpDir = _strdup(ArchWindowsUtf16ToUtf8(tmpPath).c_str());
737737
#elif defined(ARCH_OS_DARWIN)
738738
// On Apple platforms, we use the system APIs to get the designated temp directory
739-
_TmpDir = Arch_DarwinGetTemporaryDirectory();
739+
_TmpDir = strdup(Arch_DarwinGetTemporaryDirectory());
740740
#else
741741
const std::string tmpdir = ArchGetEnv("TMPDIR");
742742
if (!tmpdir.empty()) {

0 commit comments

Comments
 (0)