summaryrefslogtreecommitdiffhomepage
path: root/examples/strsep-invalid-free.c
blob: e01685dd4bc84b1145abbcf517c5b6c9bc44ec9e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{
	char *str = strdup("Hello World"), *tkn;

	printf("str [%s@%p]\n", str, str);
	tkn = strsep(&str, " ");
	printf("tkn [%s] str [%s@%p]\n", tkn, str, str);

	free(str);

	return 0;
}