# zend_list_delete

- Thread: https://externals.io/message/15580
- Original archive: https://news-web.php.net/php.internals/15580
- Started by Jesse Binam on 2005-03-24T14:44:18+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #15580 — Jesse Binam — 2005-03-24T14:44:18+00:00

URL: https://externals.io/message/15580#15580

does zend_list_delete free the resource making lines 2 & 3 redundent?

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)

---

## #15582 — Marcus Boerger — 2005-03-24T15:38:35+00:00

URL: https://externals.io/message/15580#15582 · In reply to: #15580

Hello Jesse,

Thursday, March 24, 2005, 3:44:18 PM, you wrote:

> does zend_list_delete free the resource making lines 2 & 3 redundent?

> 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.

-- 
Best regards,
 Marcus                            mailto:mail@marcus-boerger.de

---

## #15586 — Sara Golemon — 2005-03-24T17:34:13+00:00

URL: https://externals.io/message/15580#15586 · In reply to: #15582

> > […]
le_ftpbuf);
> > […]
>
> 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
