Skip to content

Commit 9d59065

Browse files
committed
ALSA: add private_data to struct snd_jack
Added private_data and private_free fields to struct snd_jack so that the caller can assign the data. It'll be helpful for avoiding the double-free of the jack instance. Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 577c9c4 commit 9d59065

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

‎include/sound/jack.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ struct snd_jack {
5050
int type;
5151
const char *id;
5252
char name[100];
53+
void *private_data;
54+
void (*private_free)(struct snd_jack *);
5355
};
5456

5557
#ifdef CONFIG_SND_JACK

‎sound/core/jack.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ static int snd_jack_dev_free(struct snd_device *device)
3535
{
3636
struct snd_jack *jack = device->device_data;
3737

38+
if (jack->private_free)
39+
jack->private_free(jack);
40+
3841
/* If the input device is registered with the input subsystem
3942
* then we need to use a different deallocator. */
4043
if (jack->registered)

0 commit comments

Comments
 (0)