[Pkg-libvirt-commits] [libguestfs] 06/72: php: fix memory leak in OStringList optargs

Hilko Bengen bengen at moszumanska.debian.org
Sun Apr 5 15:19:46 UTC 2015


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to branch master
in repository libguestfs.

commit 0465a90a4526f28367a9943d1d13899e8e050df9
Author: Pino Toscano <ptoscano at redhat.com>
Date:   Tue Feb 10 16:09:57 2015 +0100

    php: fix memory leak in OStringList optargs
    
    Make sure to free the char** created to convert the arguments.
    
    (cherry picked from commit 2b06c27fd76eb2d18a3c1287ed5dfaa80aab4816)
---
 generator/php.ml | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/generator/php.ml b/generator/php.ml
index 7f53d43..28dde2c 100644
--- a/generator/php.ml
+++ b/generator/php.ml
@@ -451,6 +451,16 @@ PHP_FUNCTION (guestfs_last_error)
             pr "\n"
         | Bool _ | Int _ | Int64 _ | Pointer _ -> ()
         ) args;
+      List.iter (
+        function
+        | OBool n | OInt n | OInt64 n | OString n -> ()
+        | OStringList n ->
+            let uc_n = String.uppercase n in
+            pr "  if ((optargs_s.bitmask & %s_%s_BITMASK) != 0)\n"
+              c_optarg_prefix uc_n;
+            pr "    guestfs_efree_stringlist ((char **) optargs_s.%s);\n" n;
+            pr "\n"
+      ) optargs;
 
       (* Check for errors. *)
       (match errcode_of_ret ret with

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list