mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
Finally fixed the buffer
I suppose valgrind, et. al. complaining is a good thing, overall.
This commit is contained in:
@@ -62,6 +62,7 @@ static int nativeLoadScript(Toy_Interpreter* interpreter, Toy_LiteralArray* argu
|
||||
|
||||
if (!source) {
|
||||
interpreter->errorOutput("Failed to load source file\n");
|
||||
Toy_freeLiteral(filePathLiteral);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -70,6 +71,7 @@ static int nativeLoadScript(Toy_Interpreter* interpreter, Toy_LiteralArray* argu
|
||||
|
||||
if (!bytecode) {
|
||||
interpreter->errorOutput("Failed to compile source file\n");
|
||||
Toy_freeLiteral(filePathLiteral);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -626,7 +628,9 @@ Toy_Literal Toy_getFilePathLiteral(Toy_Interpreter* interpreter, Toy_Literal* dr
|
||||
Toy_deleteRefString(path);
|
||||
Toy_deleteRefString(drivePath);
|
||||
|
||||
Toy_Literal result = TOY_TO_STRING_LITERAL(Toy_createRefStringLength(filePath, realLength));
|
||||
|
||||
TOY_FREE_ARRAY(char, filePath, realLength + 1);
|
||||
|
||||
return TOY_TO_STRING_LITERAL(Toy_createRefStringLength(filePath, realLength));
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user