mirror of
https://github.com/vivier/EMILE.git
synced 2024-10-11 07:23:40 +00:00
clear mallocated memory
This commit is contained in:
parent
f143ea45a2
commit
f112a09c5d
@ -109,13 +109,13 @@ int emile_scsi_create_container(int fd, short *unit_id,
|
|||||||
unsigned long first_block;
|
unsigned long first_block;
|
||||||
int sector_size;
|
int sector_size;
|
||||||
int block_size;
|
int block_size;
|
||||||
int sectors_per_block;
|
unsigned long sectors_per_block;
|
||||||
int current;
|
int current;
|
||||||
int logical;
|
int logical;
|
||||||
int physical;
|
int physical;
|
||||||
int last_physical;
|
int last_physical;
|
||||||
int zone;
|
unsigned long zone;
|
||||||
int aggregate;
|
unsigned long aggregate;
|
||||||
|
|
||||||
ret = fstat(fd, &st);
|
ret = fstat(fd, &st);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
@ -177,7 +177,6 @@ int emile_scsi_create_container(int fd, short *unit_id,
|
|||||||
|
|
||||||
/* end of list */
|
/* end of list */
|
||||||
|
|
||||||
ADD_BLOCK(0, 0);
|
ADD_BLOCK(0L, 0L);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <linux/fs.h>
|
#include <linux/fs.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "libemile.h"
|
#include "libemile.h"
|
||||||
|
|
||||||
@ -47,6 +48,7 @@ struct emile_container *emile_second_create_mapfile(short *unit_id, char *mapfil
|
|||||||
close(fd);
|
close(fd);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
memset(container, 0, block_size);
|
||||||
|
|
||||||
|
|
||||||
ret = emile_scsi_create_container(fd, &unit_id_map, container,
|
ret = emile_scsi_create_container(fd, &unit_id_map, container,
|
||||||
@ -83,6 +85,7 @@ struct emile_container *emile_second_create_mapfile(short *unit_id, char *mapfil
|
|||||||
|
|
||||||
/* now, we must know where is the map file */
|
/* now, we must know where is the map file */
|
||||||
|
|
||||||
|
memset(container, 0, block_size);
|
||||||
fd = open(mapfile, O_RDONLY);
|
fd = open(mapfile, O_RDONLY);
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user