mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zipl: add free_common_ipl_data()
Add a small helper function to free the common ipl data to avoid having the same code duplicated multiple times. Also remove the if() check before the free as it is allowed to pass NULL pointers to free(). Signed-off-by: Sven Schnelle <svens@linux.ibm.com> Reviewed-by: Stefan Haberland <sth@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
e384f06014
commit
5894e3f700
+13
-22
@@ -367,29 +367,26 @@ free_envblk_data(struct job_envblk_data *data)
|
||||
free(data->buf);
|
||||
}
|
||||
|
||||
static void
|
||||
free_common_ipl_data(struct job_common_ipl_data *common)
|
||||
{
|
||||
free(common->image);
|
||||
free(common->parmline);
|
||||
free(common->ramdisk);
|
||||
}
|
||||
|
||||
static void
|
||||
free_ipl_data(struct job_ipl_data* data)
|
||||
{
|
||||
if (data->common.image != NULL)
|
||||
free(data->common.image);
|
||||
if (data->common.parmline != NULL)
|
||||
free(data->common.parmline);
|
||||
if (data->common.ramdisk != NULL)
|
||||
free(data->common.ramdisk);
|
||||
free_common_ipl_data(&data->common);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
free_ipl_tape_data(struct job_ipl_tape_data* data)
|
||||
{
|
||||
if (data->device != NULL)
|
||||
free(data->device);
|
||||
if (data->common.image != NULL)
|
||||
free(data->common.image);
|
||||
if (data->common.parmline != NULL)
|
||||
free(data->common.parmline);
|
||||
if (data->common.ramdisk != NULL)
|
||||
free(data->common.ramdisk);
|
||||
free(data->device);
|
||||
free_common_ipl_data(&data->common);
|
||||
}
|
||||
|
||||
|
||||
@@ -404,14 +401,8 @@ free_segment_data(struct job_segment_data* data)
|
||||
static void
|
||||
free_dump_data(struct job_dump_data* data)
|
||||
{
|
||||
if (data->device != NULL)
|
||||
free(data->device);
|
||||
if (data->common.image != NULL)
|
||||
free(data->common.image);
|
||||
if (data->common.parmline != NULL)
|
||||
free(data->common.parmline);
|
||||
if (data->common.ramdisk != NULL)
|
||||
free(data->common.ramdisk);
|
||||
free(data->device);
|
||||
free_common_ipl_data(&data->common);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user