Bug 31995 - Resource leak in ::HB_ArabicShape
Summary: Resource leak in ::HB_ArabicShape
Status: RESOLVED FIXED
Alias: None
Product: HarfBuzz
Classification: Unclassified
Component: src (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Behdad Esfahbod
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-30 02:23 UTC by Juuso Pakarinen
Modified: 2012-07-30 14:52 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Juuso Pakarinen 2010-11-30 02:23:22 UTC
Code analyser tool runned against QT including HarfBuzz reveiled resource leak in ::HB_ArabicShape
Fix proposal:

diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-arabic.c b/src/3rdparty/harfbuzz/src/harfbuzz-arabic.c
index 3837087..51f839a 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-arabic.c
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-arabic.c
@@ -1111,16 +1111,22 @@ HB_Bool HB_ArabicShape(HB_ShaperItem *item)
 
     if (HB_SelectScript(item, item->item.script == HB_Script_Arabic ? arabic_features : syriac_features)) {
         HB_Bool ot_ok;
-        if (arabicSyriacOpenTypeShape(item, &ot_ok))
+        if (arabicSyriacOpenTypeShape(item, &ot_ok)) {
+            HB_FREE_STACKARRAY(shapedChars);
             return TRUE;
-        if (ot_ok)
+        }
+        if (ot_ok) {
+            HB_FREE_STACKARRAY(shapedChars);
             return FALSE;
             /* fall through to the non OT code*/
+        }
     }
 #endif
 
-    if (item->item.script != HB_Script_Arabic)
+    if (item->item.script != HB_Script_Arabic) {
+        HB_FREE_STACKARRAY(shapedChars);
         return HB_BasicShape(item);
+    }
 
     shapedString(item->string, item->stringLength, item->item.pos, item->item.length, shapedChars, &slen,
                   item->item.bidiLevel % 2,
Comment 1 Behdad Esfahbod 2010-11-30 07:03:28 UTC
Do you have a git tree with these all?
Comment 2 Juuso Pakarinen 2010-11-30 22:05:03 UTC
Yes I do, but unfortunately it is a private repository that you can't have access. Would patch files from each issue help or is the current info enough?
Comment 3 Behdad Esfahbod 2010-12-01 13:17:12 UTC
I don't really maintain that tree (aka old harfbuzz).  Lars Knoll and Simon Hausmann do, and have commit access to it.  Can you bring your internal tree to their attention please?
Comment 4 Juuso Pakarinen 2010-12-01 23:07:44 UTC
(In reply to comment #3)
> I don't really maintain that tree (aka old harfbuzz).  Lars Knoll and Simon
> Hausmann do, and have commit access to it.  Can you bring your internal tree to
> their attention please?

Yes, I guess it is possible. Could you tell me how to do it?
Comment 5 Behdad Esfahbod 2010-12-02 04:54:06 UTC
Nevermind.  I'm contacting them.
Comment 6 Juuso Pakarinen 2010-12-09 23:27:39 UTC
Any news related to this one?
Comment 7 Behdad Esfahbod 2010-12-13 09:19:15 UTC
I emailed Lars and Simon but have not heard back from them.

If you push a tree out to github or something, I can take a look.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.