[Libguestfs] [PATCH 3/3] php: fix crash with OStringList optional arguments

Pino Toscano ptoscano at redhat.com
Thu Mar 13 09:35:52 UTC 2014


Properly initialize the variables for them to NULL, so there is no crash
because of trying to use rubbish pointers.

Kind of followup of commit 289fd29f0bfbb94566d9780dd8ac3fe15e55541d.
---
 generator/php.ml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/generator/php.ml b/generator/php.ml
index 580b10f..c7e0a27 100644
--- a/generator/php.ml
+++ b/generator/php.ml
@@ -224,7 +224,7 @@ PHP_FUNCTION (guestfs_last_error)
               pr "  char *optargs_t_%s = NULL;\n" n;
               pr "  int optargs_t_%s_size = -1;\n" n
           | OStringList n ->
-              pr "  zval *optargs_t_%s;\n" n
+              pr "  zval *optargs_t_%s = NULL;\n" n
         ) optargs
       );
 
-- 
1.8.3.1




More information about the Libguestfs mailing list