diff --git a/samples/Makefile b/samples/Makefile index b1163e8..8d1d325 100644 --- a/samples/Makefile +++ b/samples/Makefile @@ -11,7 +11,7 @@ endif CFLAGS := -rdynamic -funwind-tables CXXFLAGS := $(CFLAGS) -SRCS := sample.c factorial.c +SRCS := factorial.c sample.c sample_leak.c BINS := $(patsubst %.c,%.out,$(SRCS)) all: $(BINS) diff --git a/samples/sample_leak.c b/samples/sample_leak.c new file mode 100644 index 0000000..da43bb0 --- /dev/null +++ b/samples/sample_leak.c @@ -0,0 +1,18 @@ +/* Copyright (c) 2022 LG Electronics Inc. */ +/* SPDX-License-Identifier: GPL-2.0 */ +#include + +int main(void) +{ + int *p; + + p = (int*)malloc(4); + //free(p); + + p = (int*)calloc(4, 10); + + p = (int*)realloc(p, 1000000); + free(p); + + return 0; +}