php.net |  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: cmb@php.net 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:
Package:
Bug Type:
Summary:
From: cmb@php.net
New email:
PHP Version: OS:

 

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

Test script:
---------------
<?php

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


Expected result:
----------------
valgrind reports no issues

Actual result:
--------------
valgrind reports a memory leak

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-10-26 16:47 UTC] cmb@php.net
-Assigned To: +Assigned To: cmb
 [2016-10-26 16:49 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=340725
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] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=340726
Log: Add regression test for bug #73395
 [2016-10-26 17:09 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=340727
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] cmb@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 04:01:28 2024 UTC