on master help sign in
rts/idris_rts.c: Fix referenced after allocation that may moved away
2f9d9cbEdward O'Callaghan
rts/idris_rts.c+2−1
@@ -346,10 +346,11 @@ void idris_memmove(void* dest, void* src, i_int dest_offset, i_int src_offset, i
346}
346}
347
347
348VAL idris_castIntStr(VM* vm, VAL i) {
348VAL idris_castIntStr(VM* vm, VAL i) {
349+ int x = (int) GETINT(i);
349 Closure* cl = allocate(vm, sizeof(Closure) + sizeof(char)*16, 0);
350 Closure* cl = allocate(vm, sizeof(Closure) + sizeof(char)*16, 0);
350 SETTY(cl, STRING);
351 SETTY(cl, STRING);
351 cl -> info.str = (char*)cl + sizeof(Closure);
352 cl -> info.str = (char*)cl + sizeof(Closure);
352− sprintf(cl -> info.str, "%d", (int)(GETINT(i)));
353+ sprintf(cl -> info.str, "%d", x);
353 return cl;
354 return cl;
354}
355}
355
356