aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRodrigo Arias Mallo <rodarima@gmail.com>2025-08-12 16:08:21 +0200
committerRodrigo Arias Mallo <rodarima@gmail.com>2025-08-12 20:26:36 +0200
commit7f1d018c3b5647c1581c281b463426d66e1aab6b (patch)
treea81d3744a9f8d198cb7d28cb2c58e4e96daa4da4 /src
parentbd388635c96f3fbd15cfcac82bee50256905eb02 (diff)
Fix internal page leak
A copy of the buffer is done while injecting the content for about:cache and about:dicache, so the Dstr needs to be free'd after.
Diffstat (limited to 'src')
-rw-r--r--src/cache.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cache.c b/src/cache.c
index 5a852167..3dc2eb8b 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -283,6 +283,9 @@ static int Cache_bufsize(CacheEntry_t *e)
/**
* Inject full page content directly into the cache.
* Used for "about:splash". May be used for "about:cache" too.
+ *
+ * The @param data_ds buffer is copied into the entry buffer, so it is
+ * responsibility of the caller to free it.
*/
void a_Cache_entry_inject(const DilloUrl *Url, Dstr *data_ds)
{
@@ -433,6 +436,7 @@ static int Cache_internal_url(CacheEntry_t *entry)
if (s != NULL) {
a_Cache_entry_inject(entry->Url, s);
+ dStr_free(s, 1);
/* Remove InternalUrl */
entry->Flags = CA_GotHeader + CA_GotLength;
}