OSDN Git Service

conf: Fix invalid free at parse_args()
authorTakashi Iwai <tiwai@suse.de>
Thu, 18 Mar 2021 16:43:58 +0000 (17:43 +0100)
committerTakashi Iwai <tiwai@suse.de>
Thu, 18 Mar 2021 16:43:58 +0000 (17:43 +0100)
commit7bf1dd543b37efde77946ec866dc27df5ef5754f
tree8c0696d334ec668d97fc1e3f709f7ac9e6426ba3
parent74422643eeb0bdc0e67b0362398f71856969925f
conf: Fix invalid free at parse_args()

The previous fix for memory leaks introduced a few regression.
The major one is the assert hit in the error path reaching with NULL
or uninitialized sub object.  Also, in other code paths, it's possible
that an already released sub object gets freed again.

Fix those bugs by initializing the sub object properly and add a NULL
check before calling snd_config_delete().

Fixes: ad5f255b4767 ("conf: fix memory leak on the error path in parse_args()")
Reported-and-tested-by: Mark Hills <mark@xwax.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
src/conf.c