2009-03-29 Vladimir Serbinenko <phcoder@gmail.com>

Leak fixes

      * kern/disk.c (grub_disk_cache_store): Invalidate previous cache
      in case of collision
      * disk/scsi.c (grub_scsi_open): free scsi in case of error
This commit is contained in:
phcoder 2009-03-29 21:21:19 +00:00
parent 9c323f0961
commit a8c48fd53d
3 changed files with 19 additions and 2 deletions

View file

@ -158,10 +158,13 @@ grub_disk_cache_store (unsigned long dev_id, unsigned long disk_id,
unsigned index;
struct grub_disk_cache *cache;
grub_disk_cache_invalidate (dev_id, disk_id, sector);
index = grub_disk_cache_get_index (dev_id, disk_id, sector);
cache = grub_disk_cache_table + index;
cache->lock = 1;
grub_free (cache->data);
cache->data = 0;
cache->lock = 0;
cache->data = grub_malloc (GRUB_DISK_SECTOR_SIZE << GRUB_DISK_CACHE_BITS);
if (! cache->data)