[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#8761: gnutls should use xmalloc not malloc
From: |
Ted Zlatanov |
Subject: |
bug#8761: gnutls should use xmalloc not malloc |
Date: |
Tue, 31 May 2011 09:28:27 -0500 |
User-agent: |
Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux) |
On Mon, 30 May 2011 01:35:26 -0700 Paul Eggert <eggert@cs.ucla.edu> wrote:
PE> Here's a proposed patch for the problem.
PE> * gnutls.c: Use Emacs's memory allocators.
PE> Without this change, the gnutls library would invoke malloc etc.
PE> directly, which causes problems on non-SYNC_INPUT hosts, and which
PE> runs afoul of improving memory_full behavior.
PE> (fn_gnutls_global_set_mem_functions): New macro or function pointer.
PE> (emacs_gnutls_global_init): Use it to specify xmalloc, xrealloc,
PE> xfree instead of the default malloc, realloc, free.
PE> (Fgnutls_boot): No need to check for memory allocation failure,
PE> since xmalloc does that for us.
This looks good.
PE> - if (fn_gnutls_certificate_allocate_credentials (&x509_cred) < 0)
PE> - memory_full ();
PE> + fn_gnutls_certificate_allocate_credentials (&x509_cred);
PE> - if (fn_gnutls_anon_allocate_client_credentials (&anon_cred) < 0)
PE> - memory_full ();
PE> + fn_gnutls_anon_allocate_client_credentials (&anon_cred);
I'm OK with the change, but how do I test that it behaves properly?
Ted