mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-30 17:18:21 +03:00
coverity: avoid memleak
When security_level was set, allocated filename was leaking.
This commit is contained in:
parent
14d0b0bbdd
commit
56b527a6fb
@ -1,5 +1,6 @@
|
||||
Version 2.02.177 -
|
||||
====================================
|
||||
Fix memleak of string buffer when vgcfgbackup runs in secure mode.
|
||||
Do not print error when clvmd cannot find running clvmd.
|
||||
Prevent start of new merge of snapshot if origin is already being merged.
|
||||
|
||||
|
@ -20,8 +20,13 @@ static char *_expand_filename(const char *template, const char *vg_name,
|
||||
{
|
||||
char *filename;
|
||||
|
||||
if (security_level())
|
||||
return dm_strdup(template);
|
||||
if (security_level()) {
|
||||
if (!(filename = dm_strdup(template))) {
|
||||
log_error("Failed to allocate filename.");
|
||||
return NULL;
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!(filename = dm_malloc(PATH_MAX))) {
|
||||
log_error("Failed to allocate filename.");
|
||||
@ -40,7 +45,7 @@ static char *_expand_filename(const char *template, const char *vg_name,
|
||||
dm_free(filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
out:
|
||||
dm_free(*last_filename);
|
||||
*last_filename = filename;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user