UC3M

Telematic/Audiovisual Syst./Communication Syst. Engineering

Systems Architecture

September 2017 - January 2018

17.5.  Activities

17.5.1.  Detecting anomalies with Valgrind

Work Plan

In this activity, you will execute files with errors, with Valgrind. These files are under your repository in the Valgrind_errors directory. There is a local copy here. For each of the following files, compile it with the -g directive (that is gcc -Wall -g yourfile.c -o yourexecutable), execute it with Valgrind (valgrind --leak-check=yes ./yourexecutable), and fix the reported errors, explaining in the same file (with a comment of 1-2 lines) the reason for the error:

  1. File strcpy_exercise.c: copies one string over a second one.

  2. File printing_exercise.c: copies an integer to a pointer and prints its address and the value just copied.

Assessment

Opcionalmente, upload the modified files to your repository and show the modifications to the teacher to be evaluated.