diff options
author | David Robillard <d@drobilla.net> | 2012-05-13 22:39:57 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-05-13 22:39:57 +0000 |
commit | df75109d1659ffca2915b0fc70fc069cf2a57a4e (patch) | |
tree | ccdfbbc432695ecfcd241ae3af430cf0ddee86cc /src | |
parent | 882b74cf79088a8368842cc0cd1b672114ff5ffa (diff) | |
download | suil-df75109d1659ffca2915b0fc70fc069cf2a57a4e.tar.gz suil-df75109d1659ffca2915b0fc70fc069cf2a57a4e.tar.bz2 suil-df75109d1659ffca2915b0fc70fc069cf2a57a4e.zip |
Gracefully handle instance allocation failure.
git-svn-id: http://svn.drobilla.net/lad/trunk/suil@4392 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/instance.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/instance.c b/src/instance.c index fcb7786..e8af856 100644 --- a/src/instance.c +++ b/src/instance.c @@ -176,6 +176,12 @@ suil_instance_new(SuilHost* host, // Create SuilInstance SuilInstance* instance = calloc(1, sizeof(struct SuilInstanceImpl)); + if (!instance) { + SUIL_ERRORF("Failed to allocate memory for <%s> instance\n", ui_uri); + dlclose(lib); + return NULL; + } + instance->lib_handle = lib; instance->descriptor = descriptor; @@ -226,7 +232,7 @@ suil_instance_new(SuilHost* host, (const LV2_Feature* const*)instance->features); // Failed to instantiate UI - if (!instance || !instance->handle) { + if (!instance->handle) { SUIL_ERRORF("Failed to instantiate UI <%s> in %s\n", ui_uri, ui_binary_path); suil_instance_free(instance); |