|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73395 A failing dbase_create() may leak memory
Submitted: 2016-10-26 16:47 UTC Modified: 2016-10-26 17:23 UTC
From: Assigned: cmb (profile)
Status: Closed Package: dbase (PECL)
PHP Version: 5.6.27 OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
38 - 26 = ?
Subscribe to this entry?

 [2016-10-26 16:47 UTC]
When dbase_create() fails, because a field type is missing, the function
leaks the dbhead_t memory.

Test script:

dbase_create('foo.dbf', array(array('foo')));

Expected result:
valgrind reports no issues

Actual result:
valgrind reports a memory leak


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-10-26 16:47 UTC]
-Assigned To: +Assigned To: cmb
 [2016-10-26 16:49 UTC]
Automatic comment from SVN on behalf of cmb
Log: Fix #73395: A failing dbase_create() may leak memory

We must call free_dbf_head() in this case, too.
 [2016-10-26 17:04 UTC]
Automatic comment from SVN on behalf of cmb
Log: Add regression test for bug #73395
 [2016-10-26 17:09 UTC]
Automatic comment from SVN on behalf of cmb
Log: Properly clean up in bug73395.phpt

Even though creating the database fails, an empty file is left behind,
so we have to clean that up.
 [2016-10-26 17:23 UTC]
-Status: Assigned +Status: Closed
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Feb 20 10:01:24 2020 UTC