[Ssrformat] iolib memory leak and patch

John Emhoff JEmhoff at helicosbio.com
Tue May 20 13:15:11 PDT 2008


James,

It looks like construct_trace_name in srf.c leaks memory each time it's
called: there is no matching block_destroy to the block_create at the
top. It's a pretty simple fix -- here's a patch!

-- John

--- srf.c       2008-05-20 15:59:25.000000000 -0400
+++ patched_srf.c       2008-05-20 16:01:22.000000000 -0400
@@ -789,7 +789,11 @@
     if (out_pos < name_len-1) \
         name[out_pos++] = (c); \
     else \
-        return name_len;
+    { \
+       block_destroy(blk, 1);\
+        return name_len; \
+    }
+
 
 int construct_trace_name(char *fmt, unsigned char *suffix,
                         char *name, int name_len) {
@@ -939,7 +943,7 @@
     }
 
     emit('\0');
-
+    block_destroy(blk,1);
     return out_pos;
 }


More information about the Ssrformat mailing list