Fixed string allocation (loses: #109)

This commit is contained in:
Federico Di Gregorio 2006-06-11 03:19:18 +00:00
parent caa9d0feb4
commit fb0b523586
2 changed files with 6 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2006-06-11 Federico Di Gregorio <fog@initd.org>
* Applied patch from wkv to avoid off by one allocation of
connection encoding string (Closes: #109).
2006-06-09 Federico Di Gregorio <fog@initd.org> 2006-06-09 Federico Di Gregorio <fog@initd.org>
* Release 2.0.1. * Release 2.0.1.

View File

@ -112,7 +112,7 @@ conn_connect(connectionObject *self)
return -1; return -1;
} }
tmp = PQgetvalue(pgres, 0, 0); tmp = PQgetvalue(pgres, 0, 0);
self->encoding = PyMem_Malloc(strlen(tmp)); self->encoding = PyMem_Malloc(strlen(tmp)+1);
if (self->encoding == NULL) { if (self->encoding == NULL) {
/* exception already set by PyMem_Malloc() */ /* exception already set by PyMem_Malloc() */
PQfinish(pgconn); PQfinish(pgconn);