// doublefree.c — liberar dos veces el mismo bloque.
// Sin valgrind, glibc suele abortar: "free(): double free detected".
//   valgrind ./doublefree
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

static void cleanup(char *buf) {
    free(buf);
}

int main(void) {
    char *buf = malloc(32);
    if (buf == NULL)
        return 1;
    strcpy(buf, "hola");
    printf("%s\n", buf);
    cleanup(buf);
    free(buf);   // segundo free del mismo bloque
    return 0;
}
