fixed memory leak
This commit is contained in:
+2
-2
@@ -11,7 +11,7 @@ fun append_esclamation_mark(A, n)
|
||||
|
||||
i = 0;
|
||||
while i < n:
|
||||
{
|
||||
{
|
||||
A = strcat(A, '!');
|
||||
i = i + 1;
|
||||
}
|
||||
@@ -19,4 +19,4 @@ fun append_esclamation_mark(A, n)
|
||||
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 "../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);
|
||||
|
||||
if(argv2[i] == NULL)
|
||||
return 0;
|
||||
{
|
||||
free(argv2);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
else UNREACHABLE;
|
||||
|
||||
Reference in New Issue
Block a user