1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-27 01:25:34 +00:00

[mujs] memcount mem_realloc and mem_free for mujs

Also commented code in mujs_element_init. It caused only a memory leak.
This commit is contained in:
Witold Filipczyk 2023-10-27 20:37:50 +02:00
parent 263a06396d
commit d5dc632443
2 changed files with 5 additions and 4 deletions

View File

@ -2612,7 +2612,7 @@ mjs_push_element(js_State *J, void *node)
void *second = attr_find_in_map(map_privates, node);
if (0 && second) {
if (second) {
el_private = (struct mjs_element_private *)second;
if (!attr_find_in_map(map_elements, el_private)) {
@ -2705,9 +2705,10 @@ mjs_push_element(js_State *J, void *node)
int
mjs_element_init(js_State *J)
{
#if 0
mjs_push_element(J, NULL);
js_defglobal(J, "Element", JS_DONTENUM);
#endif
return 0;
}

View File

@ -413,7 +413,7 @@ el_mujs_alloc(void *memctx, void *ptr, int size)
fprintf(stderr, "mujs free %p not found\n", ptr);
return NULL;
}
free(ptr);
mem_free(ptr);
el_mujs_allocs.erase(el);
return NULL;
}
@ -428,7 +428,7 @@ el_mujs_alloc(void *memctx, void *ptr, int size)
el_mujs_allocs.erase(el);
}
}
void *ret = realloc(ptr, (size_t)size);
void *ret = mem_realloc(ptr, (size_t)size);
if (ret) {
el_mujs_allocs[ret] = (uint64_t)size;