Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751747AbbEFWcs (ORCPT ); Wed, 6 May 2015 18:32:48 -0400 Received: from mail-lb0-f180.google.com ([209.85.217.180]:36792 "EHLO mail-lb0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751119AbbEFWco (ORCPT ); Wed, 6 May 2015 18:32:44 -0400 MIME-Version: 1.0 In-Reply-To: <554A923F.2040205@ispras.ru> References: <1430948924-4756-1-git-send-email-khoroshilov@ispras.ru> <554A923F.2040205@ispras.ru> Date: Wed, 6 May 2015 19:32:42 -0300 Message-ID: Subject: Re: [PATCH] iio: hid-sensors: Fix memory leak on failure path in hid_prox_probe() From: Fabio Estevam To: Alexey Khoroshilov Cc: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald , linux-iio@vger.kernel.org, linux-kernel , ldv-project@linuxtesting.org Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 705 Lines: 20 On Wed, May 6, 2015 at 7:14 PM, Alexey Khoroshilov wrote: > Not exactly. Other calls are after > indio_dev->channels = channels; > So, > error_free_dev_mem: > kfree(indio_dev->channels); > works for them well. indio_dev is allocated using devm_ , so you don't need to free it. Your patch is not correct because you only kfree(channels) in the prox_parse_report() error case, but you missed the other subsequent functions. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/