pmxcfs: status: avoid memleak when allocating new filename string
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
This commit is contained in:
parent
1a483ba14d
commit
d408cb295d
1 changed files with 5 additions and 0 deletions
|
|
@ -1358,6 +1358,7 @@ static void update_rrd_data(const char *key, gconstpointer data, size_t len) {
|
|||
} else if (g_file_test(dir_pve2, G_FILE_TEST_IS_DIR)) {
|
||||
use_pve2_file = 1;
|
||||
|
||||
g_free(filename);
|
||||
filename = g_strdup_printf("%s", filename_pve2);
|
||||
|
||||
int argcount = sizeof(rrd_def_node) / sizeof(void *) - 1;
|
||||
|
|
@ -1411,6 +1412,7 @@ static void update_rrd_data(const char *key, gconstpointer data, size_t len) {
|
|||
} else if (g_file_test(filename_pve2, G_FILE_TEST_EXISTS)) {
|
||||
// old file exists, use it
|
||||
use_pve2_file = 1;
|
||||
g_free(filename);
|
||||
filename = g_strdup_printf("%s", filename_pve2);
|
||||
} else {
|
||||
// neither file exists, check for directories to decide and create file
|
||||
|
|
@ -1424,6 +1426,7 @@ static void update_rrd_data(const char *key, gconstpointer data, size_t len) {
|
|||
} else if (g_file_test(dir_pve2, G_FILE_TEST_IS_DIR)) {
|
||||
use_pve2_file = 1;
|
||||
|
||||
g_free(filename);
|
||||
filename = g_strdup_printf("%s", filename_pve2);
|
||||
|
||||
int argcount = sizeof(rrd_def_vm) / sizeof(void *) - 1;
|
||||
|
|
@ -1479,6 +1482,7 @@ static void update_rrd_data(const char *key, gconstpointer data, size_t len) {
|
|||
// TODO: get conditions so, that we do not have this empty branch
|
||||
} else if (g_file_test(filename_pve2, G_FILE_TEST_EXISTS)) {
|
||||
// old file exists, use it
|
||||
g_free(filename);
|
||||
filename = g_strdup_printf("%s", filename_pve2);
|
||||
} else {
|
||||
// neither file exists, check for directories to decide and create file
|
||||
|
|
@ -1490,6 +1494,7 @@ static void update_rrd_data(const char *key, gconstpointer data, size_t len) {
|
|||
int argcount = sizeof(rrd_def_storage_pve9_0) / sizeof(void *) - 1;
|
||||
create_rrd_file(filename, argcount, rrd_def_storage_pve9_0);
|
||||
} else if (g_file_test(dir_pve2, G_FILE_TEST_IS_DIR)) {
|
||||
g_free(filename);
|
||||
filename = g_strdup_printf("%s", filename_pve2);
|
||||
|
||||
int argcount = sizeof(rrd_def_storage) / sizeof(void *) - 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue