1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

pdo_dblib: Use stack local array instead of heap allocation (#18801)

This commit is contained in:
Niels Dossche
2025-06-09 11:13:46 +02:00
committed by GitHub
parent c02f6fb3fe
commit 4852a2c5cc

View File

@@ -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)