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

Skip NULL check before dm_free

dm_free checks for NULL itself.
This commit is contained in:
Zdenek Kabelac 2011-01-28 10:16:04 +00:00
parent 65fc4dae3a
commit a5c6acf22a
4 changed files with 8 additions and 21 deletions

View File

@ -69,8 +69,7 @@ void archive_exit(struct cmd_context *cmd)
{ {
if (!cmd->archive_params) if (!cmd->archive_params)
return; return;
if (cmd->archive_params->dir) dm_free(cmd->archive_params->dir);
dm_free(cmd->archive_params->dir);
memset(cmd->archive_params, 0, sizeof(*cmd->archive_params)); memset(cmd->archive_params, 0, sizeof(*cmd->archive_params));
} }
@ -183,8 +182,7 @@ void backup_exit(struct cmd_context *cmd)
{ {
if (!cmd->backup_params) if (!cmd->backup_params)
return; return;
if (cmd->backup_params->dir) dm_free(cmd->backup_params->dir);
dm_free(cmd->backup_params->dir);
memset(cmd->backup_params, 0, sizeof(*cmd->backup_params)); memset(cmd->backup_params, 0, sizeof(*cmd->backup_params));
} }

View File

@ -279,8 +279,7 @@ static int _cluster_request(char clvmd_cmd, const char *node, void *data, int le
*response = rarray; *response = rarray;
out: out:
if (retbuf) dm_free(retbuf);
dm_free(retbuf);
return status; return status;
} }

View File

@ -125,6 +125,5 @@ int cmp_timestamp(struct timestamp *t1, struct timestamp *t2)
void destroy_timestamp(struct timestamp *t) void destroy_timestamp(struct timestamp *t)
{ {
if (t) dm_free(t);
dm_free(t);
} }

View File

@ -486,20 +486,11 @@ void dm_task_destroy(struct dm_task *dmt)
dm_free(t); dm_free(t);
} }
if (dmt->dev_name)
dm_free(dmt->dev_name);
if (dmt->newname)
dm_free(dmt->newname);
if (dmt->message)
dm_free(dmt->message);
_dm_zfree_dmi(dmt->dmi.v4); _dm_zfree_dmi(dmt->dmi.v4);
dm_free(dmt->dev_name);
if (dmt->uuid) dm_free(dmt->newname);
dm_free(dmt->uuid); dm_free(dmt->message);
dm_free(dmt->uuid);
dm_free(dmt); dm_free(dmt);
} }