From 040dbe0b9f316dd73d5d481dd5f889b04e1629bb Mon Sep 17 00:00:00 2001 From: Ricardo Markiewicz Date: Wed, 7 Sep 2005 02:39:53 +0000 Subject: [PATCH] arreglo memory leak --- src/btree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; } -- 2.43.0