mirror of
https://github.com/libratbag/libratbag.git
synced 2026-11-08 07:33:53 +01:00
Skip the manual NULL assignment after unref
libratbag guarantees that unref() always returns NULL Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
@@ -557,10 +557,7 @@ struct ratbagd_button *ratbagd_button_free(struct ratbagd_button *button)
|
||||
return NULL;
|
||||
|
||||
button->path = mfree(button->path);
|
||||
|
||||
/* we cannot assume the button is gone, so set NULL explicitly */
|
||||
ratbag_button_unref(button->lib_button);
|
||||
button->lib_button = NULL;
|
||||
button->lib_button = ratbag_button_unref(button->lib_button);
|
||||
|
||||
return mfree(button);
|
||||
}
|
||||
|
||||
@@ -381,10 +381,7 @@ struct ratbagd_profile *ratbagd_profile_free(struct ratbagd_profile *profile)
|
||||
mfree(profile->resolutions);
|
||||
|
||||
profile->path = mfree(profile->path);
|
||||
|
||||
/* we cannot assume the profile is gone, so set NULL explicitly */
|
||||
ratbag_profile_unref(profile->lib_profile);
|
||||
profile->lib_profile = NULL;
|
||||
profile->lib_profile = ratbag_profile_unref(profile->lib_profile);
|
||||
|
||||
return mfree(profile);
|
||||
}
|
||||
|
||||
@@ -166,10 +166,7 @@ struct ratbagd_resolution *ratbagd_resolution_free(struct ratbagd_resolution *re
|
||||
return NULL;
|
||||
|
||||
resolution->path = mfree(resolution->path);
|
||||
|
||||
/* we cannot assume the resolution is gone, so set NULL explicitly */
|
||||
ratbag_resolution_unref(resolution->lib_resolution);
|
||||
resolution->lib_resolution = NULL;
|
||||
resolution->lib_resolution = ratbag_resolution_unref(resolution->lib_resolution);
|
||||
|
||||
return mfree(resolution);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user