author | Sebastian Harl <sh@tokkee.org> | |
Wed, 23 Jan 2013 08:26:48 +0000 (09:26 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Wed, 23 Jan 2013 08:26:48 +0000 (09:26 +0100) | ||
commit | 7bbba254348a7fa98c4337455a3e0eae88ce0e86 | |
tree | 50cde8126c381d076dfddbffbc46ed54fc5af461 | tree | snapshot |
parent | 099531004e4b98e1e1d8a023975799708473b011 | commit | diff |
postgresql plugin: Don't access realloc'ed memory.
D'oh! This is the most stupidest bug: all database connection objects are
stored in a plugin-global array and a pointer to each object was passed around
to the worker functions. This array used to be an array of objects (rather
than pointers) and was realloc'ed every time a new connection was added. Now,
the realloc caused the old pointer to not be valid any more, thus, any but the
last database connection were later accessing memory out of range. This caused
the plugin to segfault if more than one database connection was used.
Thanks to Greg Swift for reporting this!
Fixes Github issue #238.
D'oh! This is the most stupidest bug: all database connection objects are
stored in a plugin-global array and a pointer to each object was passed around
to the worker functions. This array used to be an array of objects (rather
than pointers) and was realloc'ed every time a new connection was added. Now,
the realloc caused the old pointer to not be valid any more, thus, any but the
last database connection were later accessing memory out of range. This caused
the plugin to segfault if more than one database connection was used.
Thanks to Greg Swift for reporting this!
Fixes Github issue #238.
src/postgresql.c | diff | blob | history |