summaryrefslogtreecommitdiff
path: root/ext/dbase
diff options
context:
space:
mode:
authorSterling Hughes <sterling@php.net>2000-06-30 22:44:20 +0000
committerSterling Hughes <sterling@php.net>2000-06-30 22:44:20 +0000
commit857e80f5c644b8165bd23343e0f3ee923cac69d2 (patch)
treee9d2712ff63471069cb9a223e641ce912775afb1 /ext/dbase
parent7f7c14d9f544c66732af95eeb25491bc2cae53e4 (diff)
downloadphp-git-857e80f5c644b8165bd23343e0f3ee923cac69d2.tar.gz
Fix bug 4813. Fixed by greg@darkphoton.com
Diffstat (limited to 'ext/dbase')
-rw-r--r--ext/dbase/dbase.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/ext/dbase/dbase.c b/ext/dbase/dbase.c
index 0401f7a2c2..9b4b43431b 100644
--- a/ext/dbase/dbase.c
+++ b/ext/dbase/dbase.c
@@ -617,7 +617,20 @@ PHP_FUNCTION(dbase_create) {
dbh->db_hlen = sizeof(struct dbf_dhead) + 2 + num_fields * sizeof(struct dbf_dfield);
rlen = 1;
-
+ /**
+ * Patch by greg@darkphoton.com
+ **/
+ /* make sure that the db_format entries for all fields are set to NULL to ensure we
+ don't seg fault if there's an error and we need to call free_dbf_head() before all
+ fields have been defined. */
+ for (i = 0, cur_f = dbf; i < num_fields; i++, cur_f++) {
+ cur_f->db_format = NULL;
+ }
+ /**
+ * end patch
+ */
+
+
for (i = 0, cur_f = dbf; i < num_fields; i++, cur_f++) {
/* look up the first field */
if (zend_hash_index_find(fields->value.ht, i, (void **)&value) == FAILURE) {