summaryrefslogtreecommitdiffstats
path: root/alsa.c
diff options
context:
space:
mode:
authorMark Farrugia <mark.farrugia@fiberdyne.com.au>2018-08-31 17:40:44 +1000
committerMark Farrugia <mark.farrugia@fiberdyne.com.au>2018-10-26 17:27:30 +1100
commitbde87475ff7d229619eb090af58c7e496bd3fa60 (patch)
treed20dce8773c4c0453636f00f98462b5e99e88601 /alsa.c
parent993a6fb52ee4a39775b7e14394650213f18913f2 (diff)
Add additional NULL checks
Check for NULL pointers before free'ing memory on cleanup of AVIRT Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
Diffstat (limited to 'alsa.c')
-rwxr-xr-xalsa.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/alsa.c b/alsa.c
index 44e0b15..738048f 100755
--- a/alsa.c
+++ b/alsa.c
@@ -203,17 +203,17 @@ int avirt_alsa_register(struct platform_device *devptr)
*/
int avirt_alsa_deregister(void)
{
+ CHK_NULL(_driver->card);
snd_card_free(_driver->card);
-
- if (_driver->playback.config)
- kfree(_driver->playback.config);
- if (_driver->playback.streams)
- kfree(_driver->playback.streams);
- if (_driver->capture.config)
- kfree(_driver->capture.config);
- if (_driver->capture.streams)
- kfree(_driver->capture.streams);
-
+ CHK_NULL(_driver->playback.config);
+ kfree(_driver->playback.config);
+ CHK_NULL(_driver->playback.streams);
+ kfree(_driver->playback.streams);
+ CHK_NULL(_driver->capture.config);
+ kfree(_driver->capture.config);
+ CHK_NULL(_driver->capture.streams);
+ kfree(_driver->capture.streams);
+ CHK_NULL(_driver);
kfree(_driver);
return 0;