com php-src: Fix unitialized opened_path here - found by Coverity: ext/dba/dba.c
| From: | Rasmus Lerdorf | Date: | Sun, 20 Oct 2013 02:24:17 +0000 |
| Subject: | com php-src: Fix unitialized opened_path here - found by Coverity: ext/dba/dba.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-73725@lists.php.net to get a copy of this message | ||
Commit: 2be67ca457299179d5df05ee569d4efa227e33d9
Author: Rasmus Lerdorf <rasmus@lerdorf.com> Sat, 19 Oct 2013 19:24:17 -0700
Parents: 813e86765263aa91a3c5c4f72b2c40b7becb58a4
Branches: PHP-5.4 PHP-5.5 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2be67ca457299179d5df05ee569d4efa227e33d9
Log:
Fix unitialized opened_path here - found by Coverity
Changed paths:
M ext/dba/dba.c
Diff:
diff --git a/ext/dba/dba.c b/ext/dba/dba.c
index 50a94dd...ced90f0 100644
--- a/ext/dba/dba.c
+++ b/ext/dba/dba.c
@@ -625,7 +625,8 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
char *file_mode;
char mode[4], *pmode, *lock_file_mode = NULL;
int persistent_flag = persistent ? STREAM_OPEN_PERSISTENT : 0;
- char *opened_path, *lock_name;
+ char *opened_path = NULL;
+ char *lock_name;
if(ac < 2) {
WRONG_PARAM_COUNT;
@@ -848,8 +849,10 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
if (!persistent) {
info->lock.name = opened_path;
} else {
- info->lock.name = pestrdup(opened_path, persistent);
- efree(opened_path);
+ if (opened_path) {
+ info->lock.name = pestrdup(opened_path, persistent);
+ efree(opened_path);
+ }
}
}
}