mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Ensure allocated device does not leak on error path
For unimplementd canonicalize_file_name set to NULL
This commit is contained in:
parent
73e62cdc11
commit
e66b3e8e3b
@ -1,5 +1,6 @@
|
||||
Version 1.02.71 -
|
||||
====================================
|
||||
Fix memory leak in fail path of parse_loop_device_name() in dmsetup.
|
||||
Check for missing reply_uuid in dm_event_get_registered_device().
|
||||
Check for allocation failure in dmeventd restart().
|
||||
Add few missing allocation failures tests in dmsetup.
|
||||
|
@ -3043,6 +3043,8 @@ static char *_get_abspath(const char *path)
|
||||
_path = canonicalize_file_name(path);
|
||||
#else
|
||||
/* FIXME Provide alternative */
|
||||
log_error(INTERNAL_ERROR "Unimplemented _get_abspath.");
|
||||
_path = NULL;
|
||||
#endif
|
||||
return _path;
|
||||
}
|
||||
@ -3050,7 +3052,7 @@ static char *_get_abspath(const char *path)
|
||||
static char *parse_loop_device_name(const char *dev, const char *dev_dir)
|
||||
{
|
||||
char *buf;
|
||||
char *device;
|
||||
char *device = NULL;
|
||||
|
||||
if (!(buf = dm_malloc(PATH_MAX)))
|
||||
return NULL;
|
||||
@ -3083,7 +3085,9 @@ static char *parse_loop_device_name(const char *dev, const char *dev_dir)
|
||||
return buf;
|
||||
|
||||
error:
|
||||
dm_free(device);
|
||||
dm_free(buf);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user