sr_scpi_hw_info_free(): Allow NULL as argument.
This commit is contained in:
parent
ce375f2a39
commit
7b365c4719
|
@ -98,8 +98,7 @@ static struct sr_dev_inst *hmo_probe_serial_device(struct sr_scpi_dev_inst *scpi
|
||||||
return sdi;
|
return sdi;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
if (hw_info)
|
sr_scpi_hw_info_free(hw_info);
|
||||||
sr_scpi_hw_info_free(hw_info);
|
|
||||||
sr_dev_inst_free(sdi);
|
sr_dev_inst_free(sdi);
|
||||||
g_free(devc);
|
g_free(devc);
|
||||||
|
|
||||||
|
|
|
@ -144,8 +144,7 @@ static struct sr_dev_inst *rs_probe_serial_device(struct sr_scpi_dev_inst *scpi)
|
||||||
return sdi;
|
return sdi;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
if (hw_info)
|
sr_scpi_hw_info_free(hw_info);
|
||||||
sr_scpi_hw_info_free(hw_info);
|
|
||||||
sr_dev_inst_free(sdi);
|
sr_dev_inst_free(sdi);
|
||||||
g_free(devc);
|
g_free(devc);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -109,8 +109,7 @@ static struct sr_dev_inst *probe_usbtmc_device(struct sr_scpi_dev_inst *scpi)
|
||||||
return sdi;
|
return sdi;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
if (hw_info)
|
sr_scpi_hw_info_free(hw_info);
|
||||||
sr_scpi_hw_info_free(hw_info);
|
|
||||||
sr_dev_inst_free(sdi);
|
sr_dev_inst_free(sdi);
|
||||||
g_free(devc);
|
g_free(devc);
|
||||||
|
|
||||||
|
|
|
@ -934,17 +934,17 @@ SR_PRIV int sr_scpi_get_hw_id(struct sr_scpi_dev_inst *scpi,
|
||||||
/**
|
/**
|
||||||
* Free a sr_scpi_hw_info struct.
|
* Free a sr_scpi_hw_info struct.
|
||||||
*
|
*
|
||||||
* @param hw_info Pointer to the struct to free.
|
* @param hw_info Pointer to the struct to free. If NULL, this
|
||||||
*
|
* function does nothing.
|
||||||
* This function is safe to call with a NULL pointer.
|
|
||||||
*/
|
*/
|
||||||
SR_PRIV void sr_scpi_hw_info_free(struct sr_scpi_hw_info *hw_info)
|
SR_PRIV void sr_scpi_hw_info_free(struct sr_scpi_hw_info *hw_info)
|
||||||
{
|
{
|
||||||
if (hw_info) {
|
if (!hw_info)
|
||||||
g_free(hw_info->manufacturer);
|
return;
|
||||||
g_free(hw_info->model);
|
|
||||||
g_free(hw_info->serial_number);
|
g_free(hw_info->manufacturer);
|
||||||
g_free(hw_info->firmware_version);
|
g_free(hw_info->model);
|
||||||
g_free(hw_info);
|
g_free(hw_info->serial_number);
|
||||||
}
|
g_free(hw_info->firmware_version);
|
||||||
|
g_free(hw_info);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue