diff options
author | MiRacLe.RPZ <miracle@rpz.name> | 2015-10-18 00:31:38 +0300 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2015-10-18 11:10:50 +0200 |
commit | 2b5af600e3577d105d5911d27805679c4a1c542b (patch) | |
tree | e5106df4e0145d94edca34ce10ad8d4685600c79 /ext/pdo_dblib | |
parent | 5c19355095e10d261e81959eac7d557e8b30ab9a (diff) | |
download | php-git-2b5af600e3577d105d5911d27805679c4a1c542b.tar.gz |
use spprintf instead (no need to estrdup afterwards).
Diffstat (limited to 'ext/pdo_dblib')
-rw-r--r-- | ext/pdo_dblib/dblib_stmt.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/ext/pdo_dblib/dblib_stmt.c b/ext/pdo_dblib/dblib_stmt.c index 5efded9deb..0b519995ca 100644 --- a/ext/pdo_dblib/dblib_stmt.c +++ b/ext/pdo_dblib/dblib_stmt.c @@ -205,15 +205,14 @@ static int pdo_dblib_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC) struct pdo_column_data *col = &stmt->columns[colno]; char *fname = (char*)dbcolname(H->link, colno+1); - char computed_buf[16]; + if (fname && *fname) { col->name = estrdup(fname); + col->namelen = strlen(col->name); } else { - snprintf(computed_buf,16,"computed%d", colno); - col->name = estrdup(computed_buf); + col->namelen = spprintf(&col->name, NULL, "computed%d", colno); } col->maxlen = dbcollen(H->link, colno+1); - col->namelen = strlen(col->name); col->param_type = PDO_PARAM_STR; return 1; |