aboutsummaryrefslogtreecommitdiff
path: root/src/html.cc
diff options
context:
space:
mode:
authorHofmann Johannes <Johannes.Hofmann@gmx.de>2009-05-10 13:44:38 -0400
committerHofmann Johannes <Johannes.Hofmann@gmx.de>2009-05-10 13:44:38 -0400
commit2023266c7206c3fb456fda012ae0a4c81b69a634 (patch)
treee67d622e5a4623a5ab30fefabdc127bec0058c6b /src/html.cc
parentfbc75f17d99ea52fd38352b165cfb2a1b8d710d0 (diff)
Fix a memory leak with DilloImage structures
Diffstat (limited to 'src/html.cc')
-rw-r--r--src/html.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/html.cc b/src/html.cc
index f20d8fa8..974b914c 100644
--- a/src/html.cc
+++ b/src/html.cc
@@ -294,6 +294,7 @@ static void Html_add_new_linkimage(DilloHtml *html,
DilloLinkImage *li = dNew(DilloLinkImage, 1);
li->url = *url;
li->image = image;
+ a_Image_ref(image);
int ni = html->images->size();
html->images->increase();
@@ -677,6 +678,7 @@ void DilloHtml::loadImages (const DilloUrl *pattern)
if (images->get(i)->image) {
if ((!pattern) || (!a_Url_cmp(images->get(i)->url, pattern))) {
Html_load_image(bw, images->get(i)->url, images->get(i)->image);
+ a_Image_unref (images->get(i)->image);
images->get(i)->image = NULL; // web owns it now
}
}
@@ -2092,6 +2094,7 @@ static void Html_load_image(BrowserWindow *bw, DilloUrl *url,
Web = a_Web_new(url);
Web->bw = bw;
Web->Image = Image;
+ a_Image_ref(Image);
Web->flags |= WEB_Image;
/* Request image data from the cache */
if ((ClientKey = a_Capi_open_url(Web, NULL, NULL)) != 0) {