]> git.llucax.com Git - z.facultad/75.06/emufs.git/blobdiff - emufs/idx.c
* BUGFIX : Estaba siendo olvidado verificar de no sobrepasar
[z.facultad/75.06/emufs.git] / emufs / idx.c
index f9c33db6f431d393dff907088fdbb97537720eea..a8c76bbebf90b766a4d9da1465ffa559071555fb 100644 (file)
@@ -214,10 +214,11 @@ EMUFS_REG_ID *emufs_idx_get(EMUFS *emu, EMUFS_REG_ID *cant)
        count = 0;
        while (!feof(f_idx)) {
                if (fread(&reg, sizeof(EMUFS_IDX), 1, f_idx) != 1) continue;
        count = 0;
        while (!feof(f_idx)) {
                if (fread(&reg, sizeof(EMUFS_IDX), 1, f_idx) != 1) continue;
-               count++;
-               /* TODO : Verificar errores :-D */
-               tmp = realloc(tmp, count*sizeof(EMUFS_REG_ID));
-               tmp[count-1] = reg.id_reg;
+               if (reg.location != EMUFS_NOT_FOUND) {
+                       count++;
+                       tmp = realloc(tmp, count*sizeof(EMUFS_REG_ID));
+                       tmp[count-1] = reg.id_reg;
+               }
        }
        fclose(f_idx);
 
        }
        fclose(f_idx);