lkml.org 
[lkml]   [2017]   [Sep]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] ALSA: hda: Fix forget to free resource in error handling code path in hda_codec_driver_probe
On Mon, 04 Sep 2017 17:17:09 +0200,
Wang YanQing wrote:
>
> When hda_codec_driver_probe meet error and return failure, we need
> to free resource with patch_ops.free, or we will get resource leak.
>
> Signed-off-by: Wang YanQing <udknight@gmail.com>
> ---
> Changes v1-v2:
> 1: Fix calling patch_ops.free after module_put, reported by Takashi Iwai.
>
> Hi! Takashi Iwai
> Because the only one calling site of patch_ops.free is in
> hda_codec_driver_remove, and if hda_codec_driver_probe return
> failure, we will no chance to call the hda_codec_driver_remove,
> so I think we don't need to care below case:
> "Or, for safety, we may put an internal flag to indicate that the codec
> free got already called, and check it at before calling
> patch_ops.free, too."

Fair enough, applied now.

I found patch_ca0132.c still misses the free at the error path in its
probe function, so I'll fix it.

thanks,

Takashi

\
 
 \ /
  Last update: 2017-09-04 17:34    [W:0.029 / U:3.816 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site