Re: zend_list_delete
| From: | Sara Golemon | Date: | Thu, 24 Mar 2005 17:34:13 +0000 |
| Subject: | Re: zend_list_delete | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-15586@lists.php.net to get a copy of this message | ||
> > 1 ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name,
le_ftpbuf);
> > 2 zend_list_delete(Z_LVAL_P(z_ftp))
> > 3 efree(ftp)
>
> Line three is wrong it should be
> zval_ptr_dtor(&z_ftp)
> and no, it doesn't make the efree()/zval_ptr_dtor() redundant.
> It only frees the members but doesn't care for the zval.
>
For that matter, it should *only* be zval_ptr_dtor(&z_ftp) since in the
process of dtoring the zval the list entry is delref'd (what list_delete
actually does) anyway.
Of course, my question for you would be. Is that *literally* how your code
looks? I.e. You fetch a resource immediately before destroying it? Or are
you just condensing for brevity?
-Sara