This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new eba292f4b9 sim/alsa: add ptr check in _stop
eba292f4b9 is described below

commit eba292f4b954a86b58de435da9c2ea35b6bf8b51
Author: qiaohaijiao1 <qiaohaiji...@xiaomi.com>
AuthorDate: Fri Feb 2 18:29:36 2024 +0800

    sim/alsa: add ptr check in _stop
    
    Signed-off-by: qiaohaijiao1 <qiaohaiji...@xiaomi.com>
---
 arch/sim/src/sim/posix/sim_alsa.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/arch/sim/src/sim/posix/sim_alsa.c 
b/arch/sim/src/sim/posix/sim_alsa.c
index fbb8808917..440ef37993 100644
--- a/arch/sim/src/sim/posix/sim_alsa.c
+++ b/arch/sim/src/sim/posix/sim_alsa.c
@@ -560,11 +560,17 @@ static int sim_audio_stop(struct audio_lowerhalf_s *dev)
   priv->dev.upper(priv->dev.priv, AUDIO_CALLBACK_COMPLETE, NULL, OK);
 #endif
 
-  apb_free(priv->aux);
-  priv->aux = NULL;
+  if (priv->aux)
+    {
+      apb_free(priv->aux);
+      priv->aux = NULL;
+    }
 
-  priv->ops->uninit(priv->codec);
-  priv->ops = NULL;
+  if (priv->ops)
+    {
+      priv->ops->uninit(priv->codec);
+      priv->ops = NULL;
+    }
 
   return 0;
 }

Reply via email to