Thread: Re: pgsql: Properly unregister OpenSSL callbacks when libpq is done with

Re: pgsql: Properly unregister OpenSSL callbacks when libpq is done with

From
Kris Jurka
Date:
Magnus Hagander wrote:
> Log Message:
> -----------
> Properly unregister OpenSSL callbacks when libpq is done with
> it's connection. This is required for applications that unload
> the libpq library (such as PHP) in which case we'd otherwise
> have pointers to these functions when they no longer exist.

Breaks the build with --enable-thread-safety and --with-openssl because
of this typo.

Kris Jurka
*** a/src/interfaces/libpq/fe-secure.c
--- b/src/interfaces/libpq/fe-secure.c
***************
*** 918,925 **** destroy_ssl_system(void)
               * This means we leak a little memory on repeated load/unload
               * of the library.
               */
!             free(pqlockarray);
!             pqlockarray = NULL;
          }
      }

--- 918,925 ----
               * This means we leak a little memory on repeated load/unload
               * of the library.
               */
!             free(pq_lockarray);
!             pq_lockarray = NULL;
          }
      }


Re: Re: pgsql: Properly unregister OpenSSL callbacks when libpq is done with

From
Bruce Momjian
Date:
Kris Jurka wrote:
> Magnus Hagander wrote:
> > Log Message:
> > -----------
> > Properly unregister OpenSSL callbacks when libpq is done with
> > it's connection. This is required for applications that unload
> > the libpq library (such as PHP) in which case we'd otherwise
> > have pointers to these functions when they no longer exist.
> 
> Breaks the build with --enable-thread-safety and --with-openssl because 
> of this typo.

Thanks, applied.

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


Re: Re: pgsql: Properly unregister OpenSSL callbacks when libpq is done with

From
Magnus Hagander
Date:
Bruce Momjian wrote:
> Kris Jurka wrote:
>> Magnus Hagander wrote:
>>> Log Message:
>>> -----------
>>> Properly unregister OpenSSL callbacks when libpq is done with
>>> it's connection. This is required for applications that unload
>>> the libpq library (such as PHP) in which case we'd otherwise
>>> have pointers to these functions when they no longer exist.
>> Breaks the build with --enable-thread-safety and --with-openssl because 
>> of this typo.
> 
> Thanks, applied.

That fix is wrong.

The comment clearly says the code *shouldn't* free the lockarray, so the
proper fix is to remove those two lines.

I have applied a patch that does this.

//Magnus