summaryrefslogtreecommitdiff
path: root/test/malloc/tst-asprintf.c
blob: d4c3f76763e2bd8d82d0d2542d5d683a32a2b81a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <malloc.h>

static void my_stats(void)
{
	malloc_stats();
	fprintf(stderr, "\n");
}

int main(int argc, char *argv[])
{
	char *a, *b;

	my_stats();
	asprintf(&b, "asdsadasd %ssdf\n", "AAAA");
	my_stats();
	asprintf(&a, "asdsadasd %ssdf\n", "AAAA");
	my_stats();
	free(a);
	free(b);
	my_stats();

	return 0;
}