From 586fc7a97d37622dd6437b664ab69ca2aaed8d4f Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 10 Jul 2017 15:58:31 +1000 Subject: [PATCH] hidpp20: squash memory leak on profile initialization error Signed-off-by: Peter Hutterer --- src/hidpp20.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/hidpp20.c b/src/hidpp20.c index 739aa9fc..0855a781 100644 --- a/src/hidpp20.c +++ b/src/hidpp20.c @@ -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++) {