diff options
author | Duncan Overbruck <[email protected]> | 2019-12-09 23:09:03 +0100 |
---|---|---|
committer | Matthew Gregan <[email protected]> | 2019-12-10 16:26:39 +1300 |
commit | a71f116501fe39962599c435ef65066f7e7ea9f5 (patch) | |
tree | 98db5760d71580a802b223b3daaaac77716c0414 /src/cubeb_sndio.c | |
parent | 03ec1b33870ce3a7118a0f564609a39f989b0c38 (diff) | |
download | cubeb-a71f116501fe39962599c435ef65066f7e7ea9f5.tar.gz cubeb-a71f116501fe39962599c435ef65066f7e7ea9f5.zip |
sndio: fix allocation of cubeb context
Diffstat (limited to 'src/cubeb_sndio.c')
-rw-r--r-- | src/cubeb_sndio.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/cubeb_sndio.c b/src/cubeb_sndio.c index 4a05bd8..6c3fc17 100644 --- a/src/cubeb_sndio.c +++ b/src/cubeb_sndio.c @@ -282,6 +282,8 @@ sndio_init(cubeb **context, char const *context_name) { void * libsndio = NULL; + assert(context); + #ifndef DISABLE_LIBSNDIO_DLOPEN libsndio = dlopen("libsndio.so.7.0", RTLD_LAZY); if (!libsndio) { @@ -306,7 +308,9 @@ sndio_init(cubeb **context, char const *context_name) #endif DPR("sndio_init(%s)\n", context_name); - *context = malloc(sizeof(*context)); + *context = malloc(sizeof(**context)); + if (*context == NULL) + return CUBEB_ERROR; (*context)->libsndio = libsndio; (*context)->ops = &sndio_ops; (void)context_name; |