diff --git a/ext/dba/dba.c b/ext/dba/dba.c index 0e43bc03f96..bdc11990479 100644 --- a/ext/dba/dba.c +++ b/ext/dba/dba.c @@ -279,9 +279,6 @@ static void dba_close(dba_info *info) php_stream_close(info->lock.fp); } } - if (info->lock.name) { - pefree(info->lock.name, info->flags&DBA_PERSISTENT); - } pefree(info, info->flags&DBA_PERSISTENT); } /* }}} */ @@ -754,15 +751,13 @@ restart: /* do not log errors for .lck file while in read only mode on .lck file */ lock_file_mode = "rb"; info->lock.fp = php_stream_open_wrapper(lock_name, lock_file_mode, STREAM_MUST_SEEK|IGNORE_PATH|persistent_flag, &opened_path); + if (opened_path) { + zend_string_release_ex(opened_path, 0); + } } if (!info->lock.fp) { /* when not in read mode or failed to open .lck file read only. now try again in create(write) mode and log errors */ lock_file_mode = "a+b"; - } else { - if (opened_path) { - info->lock.name = pestrndup(ZSTR_VAL(opened_path), ZSTR_LEN(opened_path), persistent); - zend_string_release_ex(opened_path, 0); - } } } if (!info->lock.fp) { @@ -773,8 +768,6 @@ restart: pefree(info->path, persistent); info->path = pestrndup(ZSTR_VAL(opened_path), ZSTR_LEN(opened_path), persistent); } - /* now store the name of the lock */ - info->lock.name = pestrndup(ZSTR_VAL(opened_path), ZSTR_LEN(opened_path), persistent); zend_string_release_ex(opened_path, 0); } } @@ -834,8 +827,6 @@ restart: info->lock.fp = NULL; info->fd = -1; - pefree(info->lock.name, persistent); - lock_file_mode = "r+b"; restarted = 1; diff --git a/ext/dba/php_dba.h b/ext/dba/php_dba.h index 70f01b99073..d71a886fa91 100644 --- a/ext/dba/php_dba.h +++ b/ext/dba/php_dba.h @@ -32,7 +32,6 @@ typedef enum { typedef struct dba_lock { php_stream *fp; - char *name; int mode; /* LOCK_EX,LOCK_SH */ } dba_lock;