From: Ricardo Markiewicz Date: Wed, 7 Sep 2005 02:39:53 +0000 (+0000) Subject: arreglo memory leak X-Git-Tag: 1_0-pre1~161 X-Git-Url: https://git.llucax.com/z.facultad/75.52/treemulator.git/commitdiff_plain/040dbe0b9f316dd73d5d481dd5f889b04e1629bb arreglo memory leak --- diff --git a/src/btree.c b/src/btree.c index e6f09e1..1cdf037 100644 --- a/src/btree.c +++ b/src/btree.c @@ -20,7 +20,7 @@ BTree *btree_create (const char *filename, unsigned int block_size) } /* Nombre de archivo */ - tree->filename = malloc(sizeof(char)+1); + tree->filename = malloc(sizeof(char)*strlen(filename)+1); strcpy (tree->filename, filename); /* Inicializo el header */ @@ -30,6 +30,7 @@ BTree *btree_create (const char *filename, unsigned int block_size) /* Creo el primer bloque vacio */ node = calloc (1, block_size); write_block (tree, node, 0); + free (node); return tree; }