Update of /cvsroot/monetdb/pathfinder/runtime
In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv6334

Modified Files:
      Tag: Nov2009
        shttpd.c 
Log Message:
Fix resource leak.
Found by Coverity.


Index: shttpd.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/shttpd.c,v
retrieving revision 1.37
retrieving revision 1.37.12.1
diff -u -d -r1.37 -r1.37.12.1
--- shttpd.c    6 Jun 2008 13:31:07 -0000       1.37
+++ shttpd.c    23 Dec 2009 15:19:36 -0000      1.37.12.1
@@ -2761,14 +2761,17 @@
 {
        struct mimetype *p;
 
-       /* XXX possible resource leak  */
        if ((p = calloc(1, sizeof(*p))) != NULL &&
            (p->ext = mystrdup(ext)) != NULL &&
            (p->mime = mystrdup(mime)) != NULL) {
                p->extlen       = strlen(p->ext);
                p->next         = mimetypes;
                mimetypes       = p;
-       }
+       } else if (p) {
+        if (p->ext) free(p->ext);
+        if (p->mime) free(p->mime);
+        free(p);
+    }
 }
 
 /*


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to