Fix a memory leak in JV and add more tests
This commit is contained in:
1 parent
eea05ff924
commit
32e324a283
2 files changed
+11
-1
No files matched your search
@@ -240,7 +240,9 @@ jv jv_array_get(jv j, int idx) {
|
||||
jv jv_array_set(jv j, int idx, jv val) {
|
||||
assert(jv_get_kind(j) == JV_KIND_ARRAY);
|
||||
// copy/free of val,j coalesced
|
||||
*jvp_array_write(&j.val.complex, idx) = val;
|
||||
jv* slot = jvp_array_write(&j.val.complex, idx);
|
||||
jv_free(*slot);
|
||||
*slot = val;
|
||||
return j;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user