diff options
author | Antony Dovgal <tony2001@php.net> | 2006-08-22 11:09:12 +0000 |
---|---|---|
committer | Antony Dovgal <tony2001@php.net> | 2006-08-22 11:09:12 +0000 |
commit | 08a9ab02ba56fbf43062073a3749407645698b51 (patch) | |
tree | 6e31d949765451bbbea08186782983971193d6ed /ext/oci8/oci8.c | |
parent | 7dfbf5b2e4dc4030dbbe137e7d4b52f15e43e5bd (diff) | |
download | php-git-08a9ab02ba56fbf43062073a3749407645698b51.tar.gz |
minor improvements
Diffstat (limited to 'ext/oci8/oci8.c')
-rw-r--r-- | ext/oci8/oci8.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index b488524ae4..3a4b3c35c9 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -897,12 +897,12 @@ sb4 php_oci_fetch_errmsg(OCIError *error_handle, text **error_buf TSRMLS_DC) if (error_code) { int tmp_buf_len = strlen(tmp_buf); - if (tmp_buf[tmp_buf_len - 1] == '\n') { + if (tmp_buf_len && tmp_buf[tmp_buf_len - 1] == '\n') { tmp_buf[tmp_buf_len - 1] = '\0'; } - if (error_buf) { + if (tmp_buf_len && error_buf) { *error_buf = NULL; - *error_buf = estrndup(tmp_buf, tmp_buf_len + 1); + *error_buf = estrndup(tmp_buf, tmp_buf_len); } } return error_code; @@ -1142,7 +1142,7 @@ open: if (alloc_non_persistent) { connection = (php_oci_connection *) ecalloc(1, sizeof(php_oci_connection)); - connection->hash_key = estrndup(hashed_details.c, hashed_details.len+1); + connection->hash_key = estrndup(hashed_details.c, hashed_details.len); connection->is_persistent = 0; } else { connection = (php_oci_connection *) calloc(1, sizeof(php_oci_connection)); @@ -1151,7 +1151,7 @@ open: } } else { connection = (php_oci_connection *) ecalloc(1, sizeof(php_oci_connection)); - connection->hash_key = estrndup(hashed_details.c, hashed_details.len+1); + connection->hash_key = estrndup(hashed_details.c, hashed_details.len); connection->is_persistent = 0; } |