Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ cat main.c
- #include <stdio.h>
- #include <stdlib.h>
- typedef struct {
- int id_cinta;
- } pmanager_t;
- int main () {
- int i = 5, n_max_cintas = 10;
- pmanager_t *datos_entrada;
- datos_entrada = (pmanager_t *)malloc(sizeof(pmanager_t)*(n_max_cintas));
- datos_entrada[i].id_cinta = 7;
- fprintf(stdout, "%i", datos_entrada[i].id_cinta);
- free(datos_entrada);
- return 0;
- }
- $ gcc -Wall -pedantic main.c
- $ valgrind ./a.out
- ==12727== Memcheck, a memory error detector
- ==12727== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
- ==12727== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
- ==12727== Command: ./a.out
- ==12727==
- 7==12727==
- ==12727== HEAP SUMMARY:
- ==12727== in use at exit: 0 bytes in 0 blocks
- ==12727== total heap usage: 1 allocs, 1 frees, 40 bytes allocated
- ==12727==
- ==12727== All heap blocks were freed -- no leaks are possible
- ==12727==
- ==12727== For counts of detected and suppressed errors, rerun with: -v
- ==12727== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement