diff options
author | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-02-05 22:05:53 +0000 |
---|---|---|
committer | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-02-05 22:05:53 +0000 |
commit | 3ec88e80365c889f824d9a171fbf197b46a7c03f (patch) | |
tree | f0746a9234070ab3b86fd953827300eb21a0f7bb /block-vvfat.c | |
parent | 8a1d02aba9f986ca03d854184cd432ee98bcd179 (diff) |
block: remove error handling from qemu_malloc() callers (Avi Kivity)
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6527 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'block-vvfat.c')
-rw-r--r-- | block-vvfat.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/block-vvfat.c b/block-vvfat.c index 1ac4472ae8..623ba986a6 100644 --- a/block-vvfat.c +++ b/block-vvfat.c @@ -159,7 +159,7 @@ static inline int array_roll(array_t* array,int index_to,int index_from,int coun is=array->item_size; from=array->pointer+index_from*is; to=array->pointer+index_to*is; - buf=malloc(is*count); + buf=qemu_malloc(is*count); memcpy(buf,from,is*count); if(index_to<index_from) @@ -725,8 +725,7 @@ static int read_directory(BDRVVVFATState* s, int mapping_index) if(first_cluster == 0 && (is_dotdot || is_dot)) continue; - buffer=(char*)malloc(length); - assert(buffer); + buffer=(char*)qemu_malloc(length); snprintf(buffer,length,"%s/%s",dirname,entry->d_name); if(stat(buffer,&st)<0) { @@ -847,8 +846,7 @@ static int init_directories(BDRVVVFATState* s, memset(&(s->first_sectors[0]),0,0x40*0x200); s->cluster_size=s->sectors_per_cluster*0x200; - s->cluster_buffer=malloc(s->cluster_size); - assert(s->cluster_buffer); + s->cluster_buffer=qemu_malloc(s->cluster_size); /* * The formula: sc = spf+1+spf*spc*(512*8/fat_type), @@ -1728,7 +1726,7 @@ static int check_directory_consistency(BDRVVVFATState *s, int cluster_num, const char* path) { int ret = 0; - unsigned char* cluster = malloc(s->cluster_size); + unsigned char* cluster = qemu_malloc(s->cluster_size); direntry_t* direntries = (direntry_t*)cluster; mapping_t* mapping = find_mapping_for_cluster(s, cluster_num); @@ -1869,7 +1867,7 @@ DLOG(checkpoint()); */ if (s->fat2 == NULL) { int size = 0x200 * s->sectors_per_fat; - s->fat2 = malloc(size); + s->fat2 = qemu_malloc(size); memcpy(s->fat2, s->fat.pointer, size); } check = vvfat_read(s->bs, @@ -2211,7 +2209,7 @@ static int commit_one_file(BDRVVVFATState* s, uint32_t first_cluster = c; mapping_t* mapping = find_mapping_for_cluster(s, c); uint32_t size = filesize_of_direntry(direntry); - char* cluster = malloc(s->cluster_size); + char* cluster = qemu_malloc(s->cluster_size); uint32_t i; int fd = 0; @@ -2373,7 +2371,7 @@ static int handle_renames_and_mkdirs(BDRVVVFATState* s) mapping_t* m = find_mapping_for_cluster(s, begin_of_direntry(d)); int l = strlen(m->path); - char* new_path = malloc(l + diff + 1); + char* new_path = qemu_malloc(l + diff + 1); assert(!strncmp(m->path, mapping->path, l2)); @@ -2774,7 +2772,7 @@ static int enable_write_target(BDRVVVFATState *s) array_init(&(s->commits), sizeof(commit_t)); - s->qcow_filename = malloc(1024); + s->qcow_filename = qemu_malloc(1024); get_tmp_filename(s->qcow_filename, 1024); if (bdrv_create(&bdrv_qcow, s->qcow_filename, s->sector_count, "fat:", 0) < 0) |