feat: adjust array-dim2 according to Memcheck result

This commit is contained in:
dancingCycle 2023-01-11 13:51:41 +01:00
parent 1ea03141b4
commit 649e1ecbee
4 changed files with 21 additions and 1 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.o

View File

@ -26,10 +26,11 @@ int main(int argc, char *argv[]) {
json_decref(arrayInt); json_decref(arrayInt);
sizeArAr = json_array_size(arrayArray); sizeArAr = json_array_size(arrayArray);
fprintf(stdout,"main() size(arrayArray): %ld\n", sizeArAr); fprintf(stdout,"main() size(arrayArray): %ld\n", sizeArAr);
json_decref(arrayArray);
fprintf(stdout,"main() Done.\n"); fprintf(stdout,"main() Done.\n");
return 0; return 0;
} }

View File

@ -17,6 +17,12 @@ CC = /usr/bin/gcc
all: main.o all: main.o
$(CC) main.c -L/usr/lib/x86_64-linux-gnu -ljansson -Wall -o $(EXE) $(CC) main.c -L/usr/lib/x86_64-linux-gnu -ljansson -Wall -o $(EXE)
# #
#Compile your program with -g to include debugging information so that Memcheck's error messages include exact line numbers.
#-O0 means no optmization
#-g - adds debugging symbols to executable
debug: main.o
$(CC) main.c -L/usr/lib/x86_64-linux-gnu -ljansson -Wall -o $(EXE) -O0 -g
#
main.o: main.o:
$(CC) -c main.c $(CC) -c main.c
# Clean Up Objects, Exectuables, Dumps out of source directory # Clean Up Objects, Exectuables, Dumps out of source directory

View File

@ -4,6 +4,12 @@
make clean all make clean all
``` ```
* build in debugging mode
```
make debug
```
* cleanup * cleanup
``` ```
@ -15,3 +21,9 @@ make clean
``` ```
./main ./main
``` ```
* run Valgrind tool `Memcheck`
```
valgrind --leak-check=yes -s ./main
```