[BACK]Return to test-reallocarray.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

File: [cvsweb.bsd.lv] / mandoc / test-reallocarray.c (download)

Revision 1.1, Wed Apr 23 21:06:41 2014 UTC (9 years, 11 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_3, VERSION_1_13_2, VERSION_1_13_1, VERSION_1_12_4, VERSION_1_12

Audit malloc(3)/calloc(3)/realloc(3) usage.
* Change eight reallocs to reallocarray to be safe from overflows.
* Change one malloc to reallocarray to be safe from overflows.
* Change one calloc to reallocarray, no zeroing needed.
* Change the order of arguments of three callocs (aesthetical).

#include <stdlib.h>

int
main(void)
{
	return( ! reallocarray(NULL, 2, 2));
}