cli: fix reference count handling in hotspot error path

The connection is automatically unreferenced when the function
returns.

Fixes: 9c5ea0917d ('devices: reuse the hotspot connection if we find appropriate one'):
(cherry picked from commit 3ecfd13ded)
(cherry picked from commit 26f1074d9d)
(cherry picked from commit 6281e32875)
This commit is contained in:
Beniamino Galvani 2020-06-18 08:49:15 +02:00 committed by Thomas Haller
parent 63fb52a58a
commit ae35fa83e3
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -4037,7 +4037,6 @@ do_device_wifi_hotspot (NmCli *nmc, int argc, char **argv)
g_return_val_if_fail (s_wsec, NMC_RESULT_ERROR_UNKNOWN);
if (!set_wireless_security_for_hotspot (s_wsec, wifi_mode, caps, password, show_password, &error)) {
g_object_unref (connection);
g_string_printf (nmc->return_text, _("Error: Invalid 'password': %s."), error->message);
g_clear_error (&error);
return NMC_RESULT_ERROR_UNKNOWN;