mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Fix missing temp_buf init for error path
In previous commit this was missing, also deallocate in reversed order.
This commit is contained in:
parent
382a1a6bea
commit
c71b47b9e6
@ -1188,7 +1188,7 @@ const char *dm_uuid_prefix(void)
|
|||||||
|
|
||||||
static int _sysfs_get_dm_name(uint32_t major, uint32_t minor, char *buf, size_t buf_size)
|
static int _sysfs_get_dm_name(uint32_t major, uint32_t minor, char *buf, size_t buf_size)
|
||||||
{
|
{
|
||||||
char *sysfs_path, *temp_buf;
|
char *sysfs_path, *temp_buf = NULL;
|
||||||
FILE *fp = NULL;
|
FILE *fp = NULL;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
size_t len;
|
size_t len;
|
||||||
@ -1232,15 +1232,15 @@ bad:
|
|||||||
if (fp && fclose(fp))
|
if (fp && fclose(fp))
|
||||||
log_sys_error("fclose", sysfs_path);
|
log_sys_error("fclose", sysfs_path);
|
||||||
|
|
||||||
dm_free(sysfs_path);
|
|
||||||
dm_free(temp_buf);
|
dm_free(temp_buf);
|
||||||
|
dm_free(sysfs_path);
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _sysfs_get_kernel_name(uint32_t major, uint32_t minor, char *buf, size_t buf_size)
|
static int _sysfs_get_kernel_name(uint32_t major, uint32_t minor, char *buf, size_t buf_size)
|
||||||
{
|
{
|
||||||
char *sysfs_path, *temp_buf, *name;
|
char *name, *sysfs_path, *temp_buf = NULL;
|
||||||
ssize_t size;
|
ssize_t size;
|
||||||
size_t len;
|
size_t len;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
@ -1281,8 +1281,8 @@ static int _sysfs_get_kernel_name(uint32_t major, uint32_t minor, char *buf, siz
|
|||||||
strcpy(buf, name);
|
strcpy(buf, name);
|
||||||
r = 1;
|
r = 1;
|
||||||
bad:
|
bad:
|
||||||
dm_free(sysfs_path);
|
|
||||||
dm_free(temp_buf);
|
dm_free(temp_buf);
|
||||||
|
dm_free(sysfs_path);
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user