[Omake] [PATCH] Fix free(buffer) / free(bufp)

Richard W.M. Jones rjones at redhat.com
Fri Feb 6 03:27:06 PST 2009


GCC 4.4 has much better data flow analysis and can catch errors where
free is called on certain non-heap objects.  It finds four errors in
omake, which are fixed by the attached patch.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
Read my OCaml programming blog: http://camltastic.blogspot.com/
Fedora now supports 68 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
-------------- next part --------------
diff -ur omake-0.9.8.5.orig/src/clib/lm_printf.c omake-0.9.8.5/src/clib/lm_printf.c
--- omake-0.9.8.5.orig/src/clib/lm_printf.c	2007-07-15 18:55:23.000000000 +0100
+++ omake-0.9.8.5/src/clib/lm_printf.c	2009-02-06 11:13:42.000000000 +0000
@@ -142,12 +142,12 @@
 #endif
     if(code < 0) {
         if(bufp != buffer)
-            free(buffer);
+            free(bufp);
         failwith("ml_print_string");
     }
     v_result = copy_string(bufp);
     if(bufp != buffer)
-        free(buffer);
+        free(bufp);
     return v_result;
 }
 
@@ -190,12 +190,12 @@
 #endif
     if(code < 0) {
         if(bufp != buffer)
-            free(buffer);
+            free(bufp);
         failwith("ml_print_string");
     }
     v_result = copy_string(bufp);
     if(bufp != buffer)
-        free(buffer);
+        free(bufp);
     return v_result;
 }
 


More information about the Omake mailing list