mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
libdm: do not leak FIEMAP extent buffer if pool allocation fails (coverity)
This commit is contained in:
parent
13426092e9
commit
bc5d67884f
@ -4401,10 +4401,14 @@ static struct _extent *_stats_get_extents_for_file(struct dm_pool *mem, int fd,
|
|||||||
unsigned long flags = 0;
|
unsigned long flags = 0;
|
||||||
uint64_t *buf;
|
uint64_t *buf;
|
||||||
|
|
||||||
|
/* grow temporary extent table in the pool */
|
||||||
|
if (!dm_pool_begin_object(mem, sizeof(*extents)))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
buf = dm_zalloc(STATS_FIE_BUF_LEN);
|
buf = dm_zalloc(STATS_FIE_BUF_LEN);
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
log_error("Could not allocate memory for FIEMAP buffer.");
|
log_error("Could not allocate memory for FIEMAP buffer.");
|
||||||
return NULL;
|
goto bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialise pointers into the ioctl buffer. */
|
/* initialise pointers into the ioctl buffer. */
|
||||||
@ -4415,10 +4419,6 @@ static struct _extent *_stats_get_extents_for_file(struct dm_pool *mem, int fd,
|
|||||||
*count = (STATS_FIE_BUF_LEN - sizeof(*fiemap))
|
*count = (STATS_FIE_BUF_LEN - sizeof(*fiemap))
|
||||||
/ sizeof(struct fiemap_extent);
|
/ sizeof(struct fiemap_extent);
|
||||||
|
|
||||||
/* grow temporary extent table in the pool */
|
|
||||||
if (!dm_pool_begin_object(mem, sizeof(*extents)))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
flags = FIEMAP_FLAG_SYNC;
|
flags = FIEMAP_FLAG_SYNC;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
Loading…
Reference in New Issue
Block a user