[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gnutls_global_set_mem_functions and GNUTLS_E_MEMORY_ERROR
From: |
Nikos Mavrogiannopoulos |
Subject: |
Re: gnutls_global_set_mem_functions and GNUTLS_E_MEMORY_ERROR |
Date: |
Tue, 23 Dec 2014 09:58:03 +0200 |
On Mon, 2014-12-22 at 19:30 +0300, Dmitry Antipov wrote:
> Hello,
> 1) Why gnutls_global_set_mem_functions is obsolete?
They should still work but they are very hard to get right now that
gnutls is being initialized in the constructor. That is because the
default gnutls_malloc() will have already been used prior to a program
calling gnutls_global_set_mem_functions().
Moreover, that API gives access to low-level allocation functions, and
that could prevent to move use talloc() at some point in the future.
That's why I decided to deprecate that API. I'm open to suggestions
though if you think there is good reason to keep that API.
> 3) Is it legal to write:
> gnutls_malloc = my_malloc;
> gnutls_realloc = my_realloc;
> gnutls_calloc = my_calloc;
> gnutls_free = my_free;
> gnutls_strdup = my_strdup;
That will have the same issue as with the
gnutls_global_set_mem_functions(). You'll most likely get a crash when
calling gnutls_global_deinit().
regards,
Nikos