ocaml: Fix memory leak in bindings for functions that return buffers.
[libguestfs.git] / generator / generator_ocaml.ml
index 4f7548c..10c18e3 100644 (file)
@@ -625,6 +625,7 @@ copy_table (char * const * argv)
        | RBufferOut _ ->
            pr "  rv = caml_alloc_string (size);\n";
            pr "  memcpy (String_val (rv), r, size);\n";
+           pr "  free (r);\n"
       );
 
       pr "  CAMLreturn (rv);\n";