1
0
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:
Zdenek Kabelac 2012-02-13 14:39:24 +00:00
parent 382a1a6bea
commit c71b47b9e6

View File

@ -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)
{
char *sysfs_path, *temp_buf;
char *sysfs_path, *temp_buf = NULL;
FILE *fp = NULL;
int r = 0;
size_t len;
@ -1232,15 +1232,15 @@ bad:
if (fp && fclose(fp))
log_sys_error("fclose", sysfs_path);
dm_free(sysfs_path);
dm_free(temp_buf);
dm_free(sysfs_path);
return r;
}
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;
size_t len;
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);
r = 1;
bad:
dm_free(sysfs_path);
dm_free(temp_buf);
dm_free(sysfs_path);
return r;
}