merge: branch 'bg/coverity'

Fix some coverity warnings.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1487
This commit is contained in:
Beniamino Galvani
2022-12-23 09:35:12 +01:00
4 changed files with 5 additions and 7 deletions

View File

@@ -908,8 +908,7 @@ nm_lldp_listener_new(int ifindex,
return self;
fail:
if (self)
nm_g_slice_free(self);
nm_g_slice_free(self);
return NULL;
}

View File

@@ -926,7 +926,7 @@ nmp_object_to_string(const NMPObject *obj,
switch (to_string_mode) {
case NMP_OBJECT_TO_STRING_ID:
if (!klass->cmd_plobj_to_string_id)
if (klass->cmd_plobj_to_string_id)
return klass->cmd_plobj_to_string_id(&obj->object, buf, buf_size);
g_snprintf(buf, buf_size, NM_HASH_OBFUSCATE_PTR_FMT, NM_HASH_OBFUSCATE_PTR(obj));
return buf;

View File

@@ -1149,7 +1149,7 @@ get_device_list(NmCli *nmc, int *argc, const char *const **argv)
if (*argc == 0) {
g_string_printf(nmc->return_text, _("Error: No interface specified."));
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
goto error;
return NULL;
}
devices = nmc_get_devices_sorted(nmc->client);
@@ -1190,9 +1190,6 @@ get_device_list(NmCli *nmc, int *argc, const char *const **argv)
}
g_free(devices);
error:
g_strfreev(arg_arr);
return queue;
}

View File

@@ -132,12 +132,14 @@ device_entry_parse(NmtDeviceEntry *deventry,
&& (!words[1] || nm_utils_ifname_valid_kernel(words[1], NULL))) {
*mac_address = words[0];
*interface_name = NULL;
g_free(words[1]);
g_free(words);
return TRUE;
} else if (nm_utils_ifname_valid_kernel(words[0], NULL)
&& (!words[1] || nm_utils_hwaddr_aton(words[1], buf, len))) {
*interface_name = words[0];
*mac_address = NULL;
g_free(words[1]);
g_free(words);
return TRUE;
}