use spprintf instead (no need to estrdup afterwards).

This commit is contained in:
MiRacLe.RPZ 2015-10-18 00:31:38 +03:00 committed by Anatol Belski
parent 5c19355095
commit 2b5af600e3

View File

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