aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimo Wischer <twischer@de.adit-jv.com>2018-07-30 16:04:59 +0200
committerDavid Robillard <d@drobilla.net>2018-08-01 19:10:05 +0200
commitfde74494c925cc5323d201972722aed6f4849506 (patch)
treefdc61080fa210d07a237000e9b8504d74dbe4fe5 /src
parent69135691415c67e597cb7840866cce0c722d2aa9 (diff)
downloadjalv-fde74494c925cc5323d201972722aed6f4849506.tar.gz
jalv-fde74494c925cc5323d201972722aed6f4849506.tar.bz2
jalv-fde74494c925cc5323d201972722aed6f4849506.zip
Avoid NULL dereference in JACK backend on startup failure
Without this, there is a segmentation fault when the initialization of Jalv fails and it exits before the backend was initialized.
Diffstat (limited to 'src')
-rw-r--r--src/jack.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/jack.c b/src/jack.c
index 7c9f387..337b3dd 100644
--- a/src/jack.c
+++ b/src/jack.c
@@ -388,9 +388,11 @@ jalv_backend_init(Jalv* jalv)
void
jalv_backend_close(Jalv* jalv)
{
- jack_client_close(jalv->backend->client);
- free(jalv->backend);
- jalv->backend = NULL;
+ if (!jalv->backend) {
+ jack_client_close(jalv->backend->client);
+ free(jalv->backend);
+ jalv->backend = NULL;
+ }
}
void
@@ -402,7 +404,9 @@ jalv_backend_activate(Jalv* jalv)
void
jalv_backend_deactivate(Jalv* jalv)
{
- jack_deactivate(jalv->backend->client);
+ if (jalv->backend) {
+ jack_deactivate(jalv->backend->client);
+ }
}
void