From: Alan Kennedy Date: Mon, 31 May 2004 08:39:36 +0000 (+0000) Subject: Small memory leak removal X-Git-Tag: svn_import_r684~14 X-Git-Url: https://git.llucax.com/z.facultad/75.06/emufs.git/commitdiff_plain/633be8619d9f383e57d7dd9d2358b09717ebcfca?hp=a559d9c266c7120220093b1e918a2473a62eccb0 Small memory leak removal --- diff --git a/emufs/indice_bplus.c b/emufs/indice_bplus.c index 323c7c0..b147284 100644 --- a/emufs/indice_bplus.c +++ b/emufs/indice_bplus.c @@ -706,7 +706,10 @@ CLAVE emufs_b_plus_obtener_menor_clave(INDICE *idx) { b_plus_destruir_nodo(node); node = b_plus_leer_nodo(idx,num_child); } - else break; + else { + b_plus_destruir_nodo(node); + return key; + } } /* Ahora estoy en la primer hoja del arbol, devuelvo la primer clave */ @@ -725,6 +728,7 @@ CLAVE emufs_b_plus_obtener_mayor_clave(INDICE *idx) { node = b_plus_leer_nodo(idx,0); if (node == NULL) { key.i_clave = -1; + b_plus_destruir_nodo(node); return key; } @@ -737,12 +741,16 @@ CLAVE emufs_b_plus_obtener_mayor_clave(INDICE *idx) { node = b_plus_leer_nodo(idx,num_child); cant_claves = node->cant_claves; } - else return key; + else { + b_plus_destruir_nodo(node); + return key; + } } /* Ahora estoy en la ultima hoja del arbol, devuelvo la ultima clave */ bucket = idx->padre->obtener_claves_raw(idx->padre,node->hijos[cant_claves-1]); key = bucket->claves[bucket->cant_keys-1]; + free(bucket->claves); free (bucket); b_plus_destruir_nodo(node);