[alsa-devel] Make snd_card_free() a no-op again for NULL ptr argument

Takashi Iwai tiwai at suse.de
Thu Jun 29 12:49:34 CEST 2017


On Thu, 29 Jun 2017 12:46:33 +0200,
Delio Brignoli wrote:
> 
> Hello Takashi,
> 
> Commit “ALSA: Use standard device refcount for card accounting” <https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/sound/core/init.c?h=v4.12-rc6&id=f24640648186b59bd39f8cd640d631bdb61a3197> changed the behaviour of snd_card_free() in case of a NULL ptr argument. Before f24640648186b59bd39f8cd640d631bdb61a3197 snd_card_free() was a no-op in case of a NULL ptr argument as I would expect for a *_free() function. Currently passing a NULL ptr results in a NULL ptr dereference.
> 
> I believe the previous behaviour is worth restoring. If you agree I’ll follow up with a patch.

In which situation do you need to pass NULL to snd_card_free()?


thanks,

Takashi


More information about the Alsa-devel mailing list