forked from drath/libratbag
Remove unnecessary NULL check before free()
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
@@ -1142,8 +1142,7 @@ hidpp10_onboard_profiles_read_macro(struct hidpp10_device *device,
|
||||
return index;
|
||||
|
||||
out_err:
|
||||
if (macro)
|
||||
free(macro);
|
||||
free(macro);
|
||||
|
||||
return rc;
|
||||
}
|
||||
@@ -2723,8 +2722,7 @@ hidpp10_device_destroy(struct hidpp10_device *dev)
|
||||
union hidpp10_macro_data **macro;
|
||||
unsigned i;
|
||||
|
||||
if (dev->dpi_table)
|
||||
free(dev->dpi_table);
|
||||
free(dev->dpi_table);
|
||||
for (i = 0; i < dev->profile_count; i++) {
|
||||
ARRAY_FOR_EACH(dev->profiles[i].macros, macro) {
|
||||
if (*macro) {
|
||||
|
||||
@@ -1596,8 +1596,7 @@ hidpp20_onboard_profiles_read_macro(struct hidpp20_device *device,
|
||||
return index;
|
||||
|
||||
out_err:
|
||||
if (macro)
|
||||
free(macro);
|
||||
free(macro);
|
||||
|
||||
return rc;
|
||||
}
|
||||
@@ -1719,8 +1718,7 @@ hidpp20_onboard_profiles_destroy(struct hidpp20_profiles *profiles_list)
|
||||
profile = &profiles_list->profiles[i];
|
||||
|
||||
ARRAY_FOR_EACH(profile->macros, macro) {
|
||||
if (*macro)
|
||||
free(*macro);
|
||||
free(*macro);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -744,8 +744,7 @@ ratbag_profile_destroy(struct ratbag_profile *profile)
|
||||
|
||||
free(profile->resolution.modes);
|
||||
|
||||
if (profile->name)
|
||||
free(profile->name);
|
||||
free(profile->name);
|
||||
|
||||
list_remove(&profile->link);
|
||||
free(profile);
|
||||
@@ -1388,8 +1387,7 @@ ratbag_button_destroy(struct ratbag_button *button)
|
||||
{
|
||||
list_remove(&button->link);
|
||||
if (button->action.macro) {
|
||||
if (button->action.macro->name)
|
||||
free(button->action.macro->name);
|
||||
free(button->action.macro->name);
|
||||
free(button->action.macro);
|
||||
}
|
||||
free(button);
|
||||
@@ -1644,8 +1642,7 @@ ratbag_button_copy_macro(struct ratbag_button *button,
|
||||
if (!button->action.macro)
|
||||
button->action.macro = zalloc(sizeof(struct ratbag_macro));
|
||||
else {
|
||||
if (button->action.macro->name)
|
||||
free(button->action.macro->name);
|
||||
free(button->action.macro->name);
|
||||
memset(button->action.macro, 0, sizeof(struct ratbag_macro));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user