Fix memory corruption
This commit is contained in:
@@ -1034,8 +1034,11 @@ inline TempArena GetScratch(Arena *c1 = NULL, Arena *c2 = NULL) {
|
||||
struct Scratch {
|
||||
TempArena checkpoint;
|
||||
Scratch() { this->checkpoint = GetScratch(); }
|
||||
|
||||
Scratch(Arena *conflict) { this->checkpoint = GetScratch(conflict); }
|
||||
Scratch(Arena *c1, Arena *c2) { this->checkpoint = GetScratch(c1, c2); }
|
||||
Scratch(Allocator conflict) { this->checkpoint = GetScratch((Arena *)conflict.object); }
|
||||
Scratch(Allocator c1, Allocator c2) { this->checkpoint = GetScratch((Arena *)c1.object, (Arena *)c2.object); }
|
||||
~Scratch() { EndTemp(checkpoint); }
|
||||
operator Arena *() { return checkpoint.arena; }
|
||||
operator Allocator() { return *checkpoint.arena; }
|
||||
|
||||
@@ -270,7 +270,7 @@ String GetExePath(Allocator allocator) {
|
||||
}
|
||||
|
||||
String GetExeDir(Allocator allocator) {
|
||||
Scratch scratch;
|
||||
Scratch scratch((Arena *)allocator.object);
|
||||
String path = GetExePath(scratch);
|
||||
path = ChopLastSlash(path);
|
||||
path = Copy(allocator, path);
|
||||
|
||||
Reference in New Issue
Block a user