Are you sure you shouldn't be using zval_ptr_dtor(args[0]) as opposed to 
zval_dtor(). I see you guys doing this a lot and usually you'd want to use 
zval_ptr_dtor(). It reduces reference count and only if the zval really 
needs freeing does it run zval_dtor() and efree(). In any case, you guys 
seem to forget the final free.

Andi

At 11:34 PM 2/25/2001 +0000, David Guerizec wrote:
>davidg          Sun Feb 25 15:34:48 2001 EDT
>
>   Modified files:
>     /php4/ext/midgard   midgard.c
>   Log:
>   force user to pass $xparam by reference (from mgd_walk_xxx_tree() 
> functions)
>
>
>Index: php4/ext/midgard/midgard.c
>diff -u php4/ext/midgard/midgard.c:1.18 php4/ext/midgard/midgard.c:1.19
>--- php4/ext/midgard/midgard.c:1.18     Sun Feb 25 11:31:17 2001
>+++ php4/ext/midgard/midgard.c  Sun Feb 25 15:34:48 2001
>@@ -1,4 +1,4 @@
>-/* $Id: midgard.c,v 1.18 2001/02/25 19:31:17 davidg Exp $
>+/* $Id: midgard.c,v 1.19 2001/02/25 23:34:48 davidg Exp $
>  Copyright (C) 1999 Jukka Zitting <[EMAIL PROTECTED]>
>  Copyright (C) 2000 The Midgard Project ry
>  Copyright (C) 2000 Emile Heyns, Aurora SA <[EMAIL PROTECTED]>
>@@ -751,22 +751,28 @@
>         zval ** xp = (zval **)xparam;
>         zval *return_value;
>
>+       if(!PZVAL_IS_REF(xp[0])) {
>+               /* DG: Do we force the user to pass it by reference ? */
>+               php_error(E_WARNING,"You must pass the fourth parameter by 
>reference.");
>+               return;
>+       }
>         ALLOC_ZVAL(return_value);       ZVAL_NULL(return_value);
>         ALLOC_ZVAL(args[0]);            ZVAL_LONG(args[0], id);
>         ALLOC_ZVAL(args[1]);            ZVAL_LONG(args[1], level);
>-       args[2] = xp[0];                // DG: is this needed ? ->
>-       zval_copy_ctor(args[2]);
>+       args[2] = xp[0];                // DG: is this needed ? 
>->zval_copy_ctor(args[2]);
>
>         if(call_user_function(CG(function_table), NULL,
>                                   xp[1], return_value, 3,
>                                   args) != SUCCESS) {
>                 php_error(E_WARNING,"Unable to call %s() - function does 
> not exist",
>                                   (xp[1])->value.str.val);
>+               zval_dtor(return_value);
>+               zval_dtor(args[0]); zval_dtor(args[1]);
>                 return;
>         }
>+
>         zval_dtor(return_value);
>-       zval_dtor(args[0]);
>-       zval_dtor(args[1]);
>+       zval_dtor(args[0]); zval_dtor(args[1]);
>  }
>
>  #if YOU_WANT_TO_TEST
>
>
>
>--
>PHP CVS Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to