Kelson has submitted this change and it was merged.

Change subject: Fix memory leak in zimwriterfs.
......................................................................


Fix memory leak in zimwriterfs.

We are using polymorphism in articlesource.cpp (a Article* pointer but
derived class as real instance).
If we want to correctly delete allocated resources, we need to let compiler
get the correct destructor in the vtable.

In our case, the data member of FileArticle was never destructed and
the internal buffer of the std::string was leaked (even if the article was
correctly deleted).

Change-Id: I58833f48a440e9c91a97637d6c11e5642eaf64ce
---
M zimwriterfs/article.h
1 file changed, 1 insertion(+), 0 deletions(-)

Approvals:
  Kelson: Verified; Looks good to me, approved



diff --git a/zimwriterfs/article.h b/zimwriterfs/article.h
index 49f7d25..4a26ead 100644
--- a/zimwriterfs/article.h
+++ b/zimwriterfs/article.h
@@ -47,6 +47,7 @@
     virtual std::string getMimeType() const;
     virtual std::string getRedirectAid() const;
     virtual bool shouldCompress() const;
+    virtual ~Article() {};
 };
 
 class MetadataArticle : public Article {

-- 
To view, visit https://gerrit.wikimedia.org/r/303775
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I58833f48a440e9c91a97637d6c11e5642eaf64ce
Gerrit-PatchSet: 1
Gerrit-Project: openzim
Gerrit-Branch: master
Gerrit-Owner: Mgautierfr <mgaut...@kymeria.fr>
Gerrit-Reviewer: Kelson <kel...@kiwix.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to