mirror of
https://github.com/rkd77/elinks.git
synced 2024-09-29 03:17:53 -04: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:
parent
263a06396d
commit
d5dc632443
@ -2612,7 +2612,7 @@ mjs_push_element(js_State *J, void *node)
|
|||||||
|
|
||||||
void *second = attr_find_in_map(map_privates, node);
|
void *second = attr_find_in_map(map_privates, node);
|
||||||
|
|
||||||
if (0 && second) {
|
if (second) {
|
||||||
el_private = (struct mjs_element_private *)second;
|
el_private = (struct mjs_element_private *)second;
|
||||||
|
|
||||||
if (!attr_find_in_map(map_elements, el_private)) {
|
if (!attr_find_in_map(map_elements, el_private)) {
|
||||||
@ -2705,9 +2705,10 @@ mjs_push_element(js_State *J, void *node)
|
|||||||
int
|
int
|
||||||
mjs_element_init(js_State *J)
|
mjs_element_init(js_State *J)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
mjs_push_element(J, NULL);
|
mjs_push_element(J, NULL);
|
||||||
js_defglobal(J, "Element", JS_DONTENUM);
|
js_defglobal(J, "Element", JS_DONTENUM);
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,7 +413,7 @@ el_mujs_alloc(void *memctx, void *ptr, int size)
|
|||||||
fprintf(stderr, "mujs free %p not found\n", ptr);
|
fprintf(stderr, "mujs free %p not found\n", ptr);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
free(ptr);
|
mem_free(ptr);
|
||||||
el_mujs_allocs.erase(el);
|
el_mujs_allocs.erase(el);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -428,7 +428,7 @@ el_mujs_alloc(void *memctx, void *ptr, int size)
|
|||||||
el_mujs_allocs.erase(el);
|
el_mujs_allocs.erase(el);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void *ret = realloc(ptr, (size_t)size);
|
void *ret = mem_realloc(ptr, (size_t)size);
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
el_mujs_allocs[ret] = (uint64_t)size;
|
el_mujs_allocs[ret] = (uint64_t)size;
|
||||||
|
Loading…
Reference in New Issue
Block a user