Menu

#184 memory leak in win.c

Unscheduled
closed
nobody
None
Bug
5
2020-08-18
2019-12-05
Ralf Fassel
No

While I have no script to show the bug, looking at the code in twapi/base/win.c #290ff it seems quite obvious that there is a mismatch between comment and code:

    /* 

     * Undo the incrref above. This will delete the object unless
     * caller had done an incr-ref on it.
     */
    for (i=0; i < ARRAYSIZE(objs); ++i) {
        ObjIncrRefs(objs[i]);
    }

Note the comment says "undo Incr-ref", yet the code does another IncrRef() instead of DecrRef().

Obvious patch:

diff -r cf302f454174 twapi/base/win.c
--- a/twapi/base/win.c  Tue Oct 29 08:18:46 2019 +0530
+++ b/twapi/base/win.c  Thu Dec 05 11:46:41 2019 +0100
@@ -292,7 +292,7 @@

      * caller had done an incr-ref on it.
      */
     for (i=0; i < ARRAYSIZE(objs); ++i) {
-        ObjIncrRefs(objs[i]);
+        ObjDecrRefs(objs[i]);
     }

     return lresult;

TNX
R'

Discussion

  • Ashok P. Nadkarni

    Urrk. Yes indeed.

     
  • Ashok P. Nadkarni

    Fixed for 4.3.9

     
  • Ashok P. Nadkarni

    • status: open --> closed
     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB