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

[document] Try to free memory of document->dom in document_done

This commit is contained in:
Witold Filipczyk 2021-06-10 15:01:15 +02:00
parent e8653c1480
commit 201a61b14f
3 changed files with 19 additions and 2 deletions

View File

@ -59,6 +59,11 @@
#include "document/html/renderer.h"
#include "document/options.h"
#include "document/refresh.h"
#ifdef CONFIG_ECMASCRIPT
#include "ecmascript/spidermonkey.h"
#endif
#include "main/module.h"
#include "main/object.h"
#include "network/dns.h"
@ -249,6 +254,7 @@ done_document(struct document *document)
free_string_list(&document->onload_snippets);
free_uri_list(&document->ecmascript_imports);
kill_timer(&document->timeout);
free_document(document->dom);
#endif
free_list(document->tags);

View File

@ -426,6 +426,16 @@ spidermonkey_check_for_exception(JSContext *ctx) {
}
void
free_document(void *doc)
{
if (!doc) {
return;
}
xmlpp::Document *docu = doc;
delete docu;
}
static void
delayed_reload(void *data)
{
@ -433,8 +443,7 @@ delayed_reload(void *data)
assert(rel);
doc_rerender_after_document_update(rel->ses);
xmlpp::Document *docu = rel->doc;
delete docu;
free_document(rel->doc);
mem_free(rel);
}

View File

@ -21,5 +21,7 @@ int spidermonkey_eval_boolback(struct ecmascript_interpreter *interpreter, struc
void spidermonkey_call_function(struct ecmascript_interpreter *interpreter, JS::HandleValue fun, struct string *ret);
void free_document(void *doc);
extern struct module spidermonkey_module;
#endif