|  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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [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-2023 The PHP Group
All rights reserved.
Last updated: Wed Jun 07 23:03:39 2023 UTC