fixed memory leak
This commit is contained in:
+2
-2
@@ -11,7 +11,7 @@ fun append_esclamation_mark(A, n)
|
|||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while i < n:
|
while i < n:
|
||||||
{
|
{
|
||||||
A = strcat(A, '!');
|
A = strcat(A, '!');
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
@@ -19,4 +19,4 @@ fun append_esclamation_mark(A, n)
|
|||||||
return A;
|
return A;
|
||||||
}
|
}
|
||||||
|
|
||||||
print(append_esclamation_mark(D, 7), '\n');
|
print(append_esclamation_mark(D, 3), '\n');
|
||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// NOTE: This data structure doesn't strictly depend on
|
||||||
|
// the runtime, so it could be moved to src/objects.
|
||||||
|
|
||||||
#include "../utils/defs.h"
|
#include "../utils/defs.h"
|
||||||
#include "../objects/objects.h"
|
#include "../objects/objects.h"
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,10 @@ static Object *call(Object *self, Object **argv, unsigned int argc, Heap *heap,
|
|||||||
argv2[i] = Object_NewNone(heap, error);
|
argv2[i] = Object_NewNone(heap, error);
|
||||||
|
|
||||||
if(argv2[i] == NULL)
|
if(argv2[i] == NULL)
|
||||||
return 0;
|
{
|
||||||
|
free(argv2);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else UNREACHABLE;
|
else UNREACHABLE;
|
||||||
|
|||||||
Reference in New Issue
Block a user