hidpp20: squash memory leak on profile initialization error

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer
2017-07-10 15:58:31 +10:00
committed by Benjamin Tissoires
parent 2faa94920e
commit 586fc7a97d

View File

@@ -1624,8 +1624,10 @@ hidpp20_onboard_profiles_allocate(struct hidpp20_device *device,
0x00,
offset,
data + offset);
if (rc < 0)
if (rc < 0) {
hidpp20_onboard_profiles_destroy(profiles);
return rc;
}
}
for (i = 0; i < profiles->num_profiles; i++) {