mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
pdo_dblib: Use stack local array instead of heap allocation (#18801)
This commit is contained in:
parent
c02f6fb3fe
commit
4852a2c5cc
1 changed files with 2 additions and 6 deletions
|
@ -233,9 +233,8 @@ zend_string *dblib_handle_last_id(pdo_dbh_t *dbh, const zend_string *name)
|
|||
pdo_dblib_db_handle *H = (pdo_dblib_db_handle *)dbh->driver_data;
|
||||
|
||||
RETCODE ret;
|
||||
char *id = NULL;
|
||||
BYTE id[32];
|
||||
size_t len;
|
||||
zend_string *ret_id;
|
||||
|
||||
/*
|
||||
* Would use scope_identity() but it's not implemented on Sybase
|
||||
|
@ -267,13 +266,10 @@ zend_string *dblib_handle_last_id(pdo_dbh_t *dbh, const zend_string *name)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
id = emalloc(32);
|
||||
len = dbconvert(NULL, (dbcoltype(H->link, 1)) , (dbdata(H->link, 1)) , (dbdatlen(H->link, 1)), SQLCHAR, (BYTE *)id, (DBINT)-1);
|
||||
dbcancel(H->link);
|
||||
|
||||
ret_id = zend_string_init(id, len, 0);
|
||||
efree(id);
|
||||
return ret_id;
|
||||
return zend_string_init((const char *) id, len, 0);
|
||||
}
|
||||
|
||||
static bool dblib_set_attr(pdo_dbh_t *dbh, zend_long attr, zval *val)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue