This commit is contained in:
2026-06-21 16:39:05 +10:00
parent b2f6883e62
commit c495b7c6fc
13 changed files with 109 additions and 101 deletions

View File

@@ -2,9 +2,9 @@
GroundFunction _GroundNewFunction(GroundState* state) {
GroundFunction function = {
.args.at = malloc(sizeof(char*) * 16),
.args.at = malloc(sizeof(GroundFunctionArg) * 16),
.args.count = 0,
.args.capacity = 0,
.args.capacity = 16,
.closure = malloc(sizeof(GroundState)),
.isNativeFunction = false,

View File

@@ -21,7 +21,14 @@ GroundObject _GroundNewObject(GroundStruct* in) {
}
strncpy(item->name, s->name, 2047);
item->value = malloc(sizeof(GroundValue));
if (item->value == NULL) {
Ground.Log.Error("malloc failed in Ground.New.Object()");
Ground.Flags.error = true;
return object;
}
*item->value = Ground.Copy.Value(s->value);
if (Ground.Flags.error) {

View File

@@ -6,7 +6,7 @@ GroundString _GroundNewString(const char* in) {
GroundString string = {
.len = len,
.cstr = malloc(sizeof(len) + 1)
.cstr = malloc(len + 1)
};
if (string.cstr == NULL) {