aboutsummaryrefslogtreecommitdiff
path: root/audio
diff options
context:
space:
mode:
authorKővágó, Zoltán <dirty.ice.hu@gmail.com>2019-09-11 01:26:18 +0200
committerGerd Hoffmann <kraxel@redhat.com>2019-10-18 07:50:53 +0200
commitd1670b20dc007c17760b076c0475eedb3d20f270 (patch)
tree8a8d34416c98282af085cbbf588c4f374b1f6197 /audio
parentf22f553efffd083ff624be116726f843a39f1148 (diff)
downloadqemu-d1670b20dc007c17760b076c0475eedb3d20f270.zip
qemu-d1670b20dc007c17760b076c0475eedb3d20f270.tar.gz
qemu-d1670b20dc007c17760b076c0475eedb3d20f270.tar.bz2
audio: fix parameter dereference before NULL check
This should fix Coverity issues CID 1405305 and 1405301. Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com> Message-id: 0eadcc88b8421bb86ce2d68ac70517f920c3ad6c.1568157545.git.DirtY.iCE.hu@gmail.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'audio')
-rw-r--r--audio/audio_template.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/audio/audio_template.h b/audio/audio_template.h
index 235d1ac..1006d6b 100644
--- a/audio/audio_template.h
+++ b/audio/audio_template.h
@@ -425,8 +425,8 @@ SW *glue (AUD_open_, TYPE) (
struct audsettings *as
)
{
- AudioState *s = card->state;
- AudiodevPerDirectionOptions *pdo = glue(audio_get_pdo_, TYPE)(s->dev);
+ AudioState *s;
+ AudiodevPerDirectionOptions *pdo;
if (audio_bug(__func__, !card || !name || !callback_fn || !as)) {
dolog ("card=%p name=%p callback_fn=%p as=%p\n",
@@ -434,6 +434,9 @@ SW *glue (AUD_open_, TYPE) (
goto fail;
}
+ s = card->state;
+ pdo = glue(audio_get_pdo_, TYPE)(s->dev);
+
ldebug ("open %s, freq %d, nchannels %d, fmt %d\n",
name, as->freq, as->nchannels, as->fmt);