зеркало из https://github.com/microsoft/msphpsql.git
Simple fixes after static analyses (#1348)
This commit is contained in:
Родитель
c9a5e8eeaa
Коммит
e2dd5137a4
|
@ -1615,7 +1615,6 @@ zend_string * pdo_sqlsrv_dbh_last_id(_Inout_ pdo_dbh_t *dbh, _In_ const zend_str
|
||||||
#if PHP_VERSION_ID < 80100
|
#if PHP_VERSION_ID < 80100
|
||||||
snprintf(buffer, LAST_INSERT_ID_QUERY_MAX_LEN, SEQUENCE_CURRENT_VALUE_QUERY, name);
|
snprintf(buffer, LAST_INSERT_ID_QUERY_MAX_LEN, SEQUENCE_CURRENT_VALUE_QUERY, name);
|
||||||
#else
|
#else
|
||||||
const char *name_str = ZSTR_VAL(name);
|
|
||||||
snprintf(buffer, LAST_INSERT_ID_QUERY_MAX_LEN, SEQUENCE_CURRENT_VALUE_QUERY, ZSTR_VAL(name));
|
snprintf(buffer, LAST_INSERT_ID_QUERY_MAX_LEN, SEQUENCE_CURRENT_VALUE_QUERY, ZSTR_VAL(name));
|
||||||
#endif
|
#endif
|
||||||
wsql_string = utf16_string_from_mbcs_string(SQLSRV_ENCODING_CHAR, buffer, sizeof(buffer), &wsql_len);
|
wsql_string = utf16_string_from_mbcs_string(SQLSRV_ENCODING_CHAR, buffer, sizeof(buffer), &wsql_len);
|
||||||
|
|
|
@ -374,6 +374,10 @@ inline void sqlsrv_free_trace( _Inout_ void* ptr, _In_ const char* file, _In_ in
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
// Unlike their C standard library's counterparts the Zend Engine's memory management functions
|
||||||
|
// emalloc or erealloc won't return NULL in case of an problem while allocating the requested
|
||||||
|
// memory but bail out and terminate the current request.
|
||||||
|
// Check www.phpinternalsbook.com/php7/memory_management/zend_memory_manager.html for details
|
||||||
inline void* sqlsrv_malloc( _In_ size_t size )
|
inline void* sqlsrv_malloc( _In_ size_t size )
|
||||||
{
|
{
|
||||||
return emalloc( size );
|
return emalloc( size );
|
||||||
|
|
|
@ -3673,7 +3673,7 @@ bool sqlsrv_params_container::send_next_packet(_Inout_ sqlsrv_stmt* stmt)
|
||||||
}
|
}
|
||||||
|
|
||||||
// The helper method send_stream_packet() returns false when EOF is reached
|
// The helper method send_stream_packet() returns false when EOF is reached
|
||||||
if (current_param->send_data_packet(stmt) == false) {
|
if (current_param && current_param->send_data_packet(stmt) == false) {
|
||||||
// Now that EOF has been reached, reset current_param for next round
|
// Now that EOF has been reached, reset current_param for next round
|
||||||
// Bear in mind that SQLParamData might request the same stream resource again
|
// Bear in mind that SQLParamData might request the same stream resource again
|
||||||
current_param = NULL;
|
current_param = NULL;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче