trivial: Always call va_end() even in the error path

This commit is contained in:
Richard Hughes 2022-04-13 12:28:55 +01:00
parent 03d166158d
commit 0d7d8b3240

View File

@ -4977,6 +4977,7 @@ fu_device_build_instance_id(FuDevice *self, GError **error, const gchar *subsyst
{
FuDevice *parent = fu_device_get_parent(self);
FuDevicePrivate *priv = GET_PRIVATE(self);
gboolean ret = TRUE;
va_list args;
g_autoptr(GString) str = g_string_new(subsystem);
@ -5001,13 +5002,18 @@ fu_device_build_instance_id(FuDevice *self, GError **error, const gchar *subsyst
G_IO_ERROR_INVALID_DATA,
"no value for %s",
key);
return FALSE;
ret = FALSE;
break;
}
g_string_append(str, i == 0 ? "\\" : "&");
g_string_append_printf(str, "%s_%s", key, value);
}
va_end(args);
/* we set an error above */
if (!ret)
return FALSE;
/* success */
fu_device_add_instance_id(self, str->str);
return TRUE;
@ -5031,6 +5037,7 @@ gboolean
fu_device_build_instance_id_quirk(FuDevice *self, GError **error, const gchar *subsystem, ...)
{
FuDevicePrivate *priv = GET_PRIVATE(self);
gboolean ret = TRUE;
va_list args;
g_autoptr(GString) str = g_string_new(subsystem);
@ -5051,13 +5058,18 @@ fu_device_build_instance_id_quirk(FuDevice *self, GError **error, const gchar *s
G_IO_ERROR_INVALID_DATA,
"no value for %s",
key);
return FALSE;
ret = FALSE;
break;
}
g_string_append(str, i == 0 ? "\\" : "&");
g_string_append_printf(str, "%s_%s", key, value);
}
va_end(args);
/* we set an error above */
if (!ret)
return FALSE;
/* success */
fu_device_add_instance_id_full(self, str->str, FU_DEVICE_INSTANCE_FLAG_ONLY_QUIRKS);
return TRUE;