1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

Fix a few leaks in reporting error paths.

This commit is contained in:
Alasdair Kergon 2007-02-14 15:12:16 +00:00
parent baee28ab5c
commit b1b6c97f7c
3 changed files with 11 additions and 2 deletions

View File

@ -1,5 +1,6 @@
Version 1.02.19 -
====================================
Fix a few leaks in reporting error paths. [1.02.15+]
Version 1.02.18 - 13th February 2007
====================================

View File

@ -504,15 +504,20 @@ struct dm_report *dm_report_init(uint32_t *report_types,
if (!(rh->mem = dm_pool_create("report", 10 * 1024))) {
log_error("dm_report_init: allocation of memory pool failed");
dm_free(rh);
return NULL;
}
/* Generate list of fields for output based on format string & flags */
if (!_parse_options(rh, output_fields))
if (!_parse_options(rh, output_fields)) {
dm_report_free(rh);
return NULL;
}
if (!_parse_keys(rh, sort_keys))
if (!_parse_keys(rh, sort_keys)) {
dm_report_free(rh);
return NULL;
}
/* Return updated types value for further compatility check by caller */
if (report_types)

View File

@ -2019,6 +2019,7 @@ static int _process_losetup_switches(const char *base, int *argc, char ***argv)
if (*argc != 2) {
fprintf(stderr, "%s: Too few arguments\n", base);
_losetup_usage(stderr);
dm_free(device_name);
return 0;
}
@ -2027,6 +2028,7 @@ static int _process_losetup_switches(const char *base, int *argc, char ***argv)
fprintf(stderr, "%s: Could not parse loop file name %s\n",
base, (*argv)[1]);
_losetup_usage(stderr);
dm_free(device_name);
return 0;
}
@ -2034,6 +2036,7 @@ static int _process_losetup_switches(const char *base, int *argc, char ***argv)
_table = dm_malloc(LOOP_TABLE_SIZE);
if (!_loop_table(_table, LOOP_TABLE_SIZE, loop_file, device_name, offset)) {
fprintf(stderr, "Could not build device-mapper table for %s\n", (*argv)[0]);
dm_free(device_name);
return 0;
}
_switches[TABLE_ARG]++;