cdba-server: Don't close what wasn't opened

In the case that we quit without actually having opened a device this
would dereference a NULL pointer, so check the device before doing so.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
This commit is contained in:
Bjorn Andersson
2021-01-25 18:49:21 -06:00
parent c43466a98f
commit 7c231568aa

View File

@@ -413,7 +413,8 @@ int main(int argc, char **argv)
done:
device_close(selected_device);
if (selected_device)
device_close(selected_device);
return 0;
}