# #if ZEND_ALLOC 0 patch

- Thread: https://externals.io/message/15892
- Original archive: https://news-web.php.net/php.internals/15892
- Started by Derick Rethans on 2005-04-07T13:42:51+00:00
- Messages: 2
- 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

---

## #15892 — Derick Rethans — 2005-04-07T13:42:51+00:00

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

Hello Andi,

the following patch fixes issues when ZEND_ALLOC is set to 0 (to be able 
to debug memory related issues in / with the engine):

http://files.derickrethans.nl/patches/zend-alloc-strndup-20050407.patch

This is because estrdup needs to allocate one more byte than the length 
and you can't do that differently with strdup. I'd like to commit this 
patch to all branches.

regards,
Derick

-- 
Derick Rethans
http://derickrethans.nl | http://ez.no | http://xdebug.org

---

## #15893 — Zeev Suraski — 2005-04-07T14:00:47+00:00

URL: https://externals.io/message/15892#15893 · In reply to: #15892

@@ -80,7 +80,7 @@ ZEND_API void *_erealloc(void *ptr, size
  ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC 
ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
  ZEND_API char *_estrndup(const char *s, unsigned int length 
ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;

-#define USE_ZEND_ALLOC 1
+#define USE_ZEND_ALLOC 0

Nice try ;)

Committed, thanks.

Zeev

At 16:42 07/04/2005, Derick Rethans wrote:
>Hello Andi,
>
>the following patch fixes issues when ZEND_ALLOC is set to 0 (to be able
>to debug memory related issues in / with the engine):
>
>http://files.derickrethans.nl/patches/zend-alloc-strndup-20050407.patch
>
>This is because estrdup needs to allocate one more byte than the length
>and you can't do that differently with strdup. I'd like to commit this
>patch to all branches.
>
>regards,
>Derick
>
>--
>Derick Rethans
>http://derickrethans.nl | http://ez.no | http://xdebug.org
