psqlodbc.git / summary / log / commit / refs
commit 1cbf2d663b265b0ea7ea40558267b8cbdb8aef5c
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: Wed Jan 21 17:49:19 2015 +0000
Fix uninitialized memory access.
Introduced by the big libpq patch. Before that, the keyset array was
allocated - and zeroed - in another function.
Spotted by Valgrind.
qresult.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/qresult.c b/qresult.c
index e87880af..045b88cc 100644
--- a/qresult.c
+++ b/qresult.c
@@ -811,6 +811,9 @@ inolog("QR_get_tupledata %p->num_fields=%d\n", self, self->num_fields);
else
tuple_size *= 2;
QR_REALLOC_return_with_error(self->keyset, KeySet, sizeof(KeySet) * tuple_size, self, "Out of mwmory while allocating keyset", FALSE);
+ memset(self->keyset + self->count_keyset_allocated * sizeof(KeySet),
+ 0,
+ (tuple_size - self->count_keyset_allocated) * sizeof(KeySet));
self->count_keyset_allocated = tuple_size;
}
}
[parent: 599bf20bef92]