[haiku-commits] Change in haiku[master]: audio/null: Fix null pointer dereference

  • From: Gerrit <review@xxxxxxxxxxxxxxxxxxx>
  • To: waddlesplash <waddlesplash@xxxxxxxxx>, haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 12 Dec 2020 11:23:12 +0000

From Murai Takashi <tmurai01@xxxxxxxxx>:

Murai Takashi has uploaded this change for review. ( 
https://review.haiku-os.org/c/haiku/+/3498 ;)


Change subject: audio/null: Fix null pointer dereference
......................................................................

audio/null: Fix null pointer dereference

Fix possible null pointer dereference at line 350-354
when 'device' is NULL at line 347.
Pointed out by cppcheck.

Change-Id: I25a090172a0d17ef3cb1fe607f70a31e579d13b0
---
M src/add-ons/kernel/drivers/audio/null/null_multi.c
1 file changed, 4 insertions(+), 1 deletion(-)



  git pull ssh://git.haiku-os.org:22/haiku refs/changes/98/3498/1

diff --git a/src/add-ons/kernel/drivers/audio/null/null_multi.c 
b/src/add-ons/kernel/drivers/audio/null/null_multi.c
index 02d2f95..28e6956 100644
--- a/src/add-ons/kernel/drivers/audio/null/null_multi.c
+++ b/src/add-ons/kernel/drivers/audio/null/null_multi.c
@@ -344,7 +344,10 @@
 {
        dprintf("null_audio: %s\n" , __func__ );

-       if (device && device->running)
+       if (device  == NULL)
+               return B_ERROR;
+
+       if (device->running)
                null_stop_hardware(device);

        delete_area(device->playback_stream.buffer_area);

-- 
To view, visit https://review.haiku-os.org/c/haiku/+/3498
To unsubscribe, or for help writing mail filters, visit 
https://review.haiku-os.org/settings

Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: I25a090172a0d17ef3cb1fe607f70a31e579d13b0
Gerrit-Change-Number: 3498
Gerrit-PatchSet: 1
Gerrit-Owner: Murai Takashi <tmurai01@xxxxxxxxx>
Gerrit-MessageType: newchange

Other related posts:

  • » [haiku-commits] Change in haiku[master]: audio/null: Fix null pointer dereference - Gerrit