mirror of
git://git.sv.gnu.org/nano.git
synced 2024-12-27 20:59:45 +03:00
Letting malloc() help to find initialization failures and uses-after-free.
Change was suggested by Mike Frysinger. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5345 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
parent
24d6b7fcf7
commit
30daf4d43f
@ -1,3 +1,8 @@
|
|||||||
|
2015-08-06 Benno Schulenberg <bensberg@justemail.net>
|
||||||
|
* src/nano.c (main): For --enable-debug builds, let malloc() help
|
||||||
|
to find initialization failures and uses-after-free. Suggested by
|
||||||
|
Mike Frysinger.
|
||||||
|
|
||||||
2015-08-04 Benno Schulenberg <bensberg@justemail.net>
|
2015-08-04 Benno Schulenberg <bensberg@justemail.net>
|
||||||
* src/nano.c (main), src/files.c (read_file), src/rcfile.c,
|
* src/nano.c (main), src/files.c (read_file), src/rcfile.c,
|
||||||
doc/man/nano.1, doc/man/nanorc.5, doc/texinfo/nano.texi: Add
|
doc/man/nano.1, doc/man/nanorc.5, doc/texinfo/nano.texi: Add
|
||||||
|
@ -2196,6 +2196,12 @@ int main(int argc, char **argv)
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
/* Help to find failed-to-initialize and use-after-free problems. */
|
||||||
|
mallopt(M_CHECK_ACTION, 3);
|
||||||
|
mallopt(M_PERTURB, 0x4c);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
{
|
{
|
||||||
/* If the locale set exists and uses UTF-8, we should use
|
/* If the locale set exists and uses UTF-8, we should use
|
||||||
|
@ -54,6 +54,10 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
#include <malloc.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Suppress warnings for __attribute__((warn_unused_result)). */
|
/* Suppress warnings for __attribute__((warn_unused_result)). */
|
||||||
#define IGNORE_CALL_RESULT(call) do { if (call) {} } while(0)
|
#define IGNORE_CALL_RESULT(call) do { if (call) {} } while(0)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user