1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

Make exit paths more robust when some init function fails.

Author: Dave Wysochanski <dwysocha@redhat.com>
This commit is contained in:
Dave Wysochanski 2009-07-08 22:18:32 +00:00
parent 0f66b7086b
commit 6e7d597a50
2 changed files with 5 additions and 1 deletions

View File

@ -65,6 +65,8 @@ int archive_init(struct cmd_context *cmd, const char *dir,
void archive_exit(struct cmd_context *cmd)
{
if (!cmd->archive_params)
return;
if (cmd->archive_params->dir)
dm_free(cmd->archive_params->dir);
memset(cmd->archive_params, 0, sizeof(*cmd->archive_params));
@ -175,6 +177,8 @@ int backup_init(struct cmd_context *cmd, const char *dir,
void backup_exit(struct cmd_context *cmd)
{
if (!cmd->backup_params)
return;
if (cmd->backup_params->dir)
dm_free(cmd->backup_params->dir);
memset(cmd->backup_params, 0, sizeof(*cmd->backup_params));

View File

@ -72,7 +72,7 @@ void label_exit(void)
struct dm_list *c, *n;
struct labeller_i *li;
for (c = _labellers.n; c != &_labellers; c = n) {
for (c = _labellers.n; c && c != &_labellers; c = n) {
n = c->n;
li = dm_list_item(c, struct labeller_i);
li->l->ops->destroy(li->l);