/*printf("FS = %d\n", fs);*/
reg.free_space = emu->tam_bloque - tam-sizeof(int);
/*lo guardo en el archivo al final "a+"*/
- if ( (f_block_free = fopen(name_f_free,"a+"))==NULL ) return -1; /*ERROR*/
+ if ( (f_block_free = fopen(name_f_free,"a+"))==NULL ) {
+ free(bloque);
+ return -1; /*ERROR*/
+ }
fwrite(®,sizeof(BLOCK_FREE_T),1,f_block_free);
fclose(f_block_free);
} else {
}
/*actualizo el archivo de espacios libres*/
/*busco el bloque que modifique*/
- if ( (f_block_free = fopen(name_f_free,"r+")) == NULL) return -1; /*ERROR*/
+ if ( (f_block_free = fopen(name_f_free,"r+")) == NULL) {
+ free(bloque);
+ return -1; /*ERROR*/
+ }
while ( !feof(f_block_free) ){
fread(®,sizeof(BLOCK_FREE_T),1,f_block_free);
if ( reg.block == num_bloque ){
}
/*actualizo el archivo de bloques y registros*/
- if ( (f_block_reg = fopen(name_f_block_reg,"ab+"))==NULL ) return -1; /*ERROR*/
+ if ( (f_block_reg = fopen(name_f_block_reg,"ab+"))==NULL ) {
+ free(bloque);
+ return -1; /*ERROR*/
+ }
reg_b.block = reg.block;
reg_b.id_reg = ID_aux;
fwrite(®_b,sizeof(BLOCK_REG_T),1,f_block_reg);