mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-08 13:00:22 +01:00
dhcp/systemd: avoid using g_free() with buffers allocated with malloc() in lease_to_ip4_config()()
Coverity says:
Error: ALLOC_FREE_MISMATCH (CWE-762):
NetworkManager-1.31.3/src/core/dhcp/nm-dhcp-systemd.c:234: alloc: Allocation of memory which must be freed using "free".
NetworkManager-1.31.3/src/core/dhcp/nm-dhcp-systemd.c:447: free: Calling "_nm_auto_g_free" frees "routes" using "g_free" but it should have been freed using "free".
# 445| }
# 446| NM_SET_OUT(out_options, g_steal_pointer(&options));
# 447|-> return g_steal_pointer(&ip4_config);
# 448| }
# 449|
Fixes: acc0d79224 ('systemd: merge branch 'systemd' into master')
This commit is contained in:
parent
44abe6d661
commit
64985beef8
1 changed files with 23 additions and 23 deletions
|
|
@ -85,29 +85,29 @@ lease_to_ip4_config(NMDedupMultiIndex *multi_idx,
|
|||
const struct in_addr * addr_list;
|
||||
char addr_str[NM_UTILS_INET_ADDRSTRLEN];
|
||||
const char * s;
|
||||
nm_auto_free_gstring GString *str = NULL;
|
||||
gs_free sd_dhcp_route **routes = NULL;
|
||||
const char *const * search_domains = NULL;
|
||||
guint16 mtu;
|
||||
int i, num;
|
||||
const void * data;
|
||||
gsize data_len;
|
||||
gboolean metered = FALSE;
|
||||
gboolean has_router_from_classless = FALSE;
|
||||
gboolean has_classless_route = FALSE;
|
||||
gboolean has_static_route = FALSE;
|
||||
const gint32 ts = nm_utils_get_monotonic_timestamp_sec();
|
||||
gint64 ts_time = time(NULL);
|
||||
struct in_addr a_address;
|
||||
struct in_addr a_netmask;
|
||||
struct in_addr a_next_server;
|
||||
struct in_addr server_id;
|
||||
struct in_addr broadcast;
|
||||
const struct in_addr * a_router;
|
||||
guint32 a_plen;
|
||||
guint32 a_lifetime;
|
||||
guint32 renewal;
|
||||
guint32 rebinding;
|
||||
nm_auto_free_gstring GString *str = NULL;
|
||||
nm_auto_free sd_dhcp_route **routes = NULL;
|
||||
const char *const * search_domains = NULL;
|
||||
guint16 mtu;
|
||||
int i, num;
|
||||
const void * data;
|
||||
gsize data_len;
|
||||
gboolean metered = FALSE;
|
||||
gboolean has_router_from_classless = FALSE;
|
||||
gboolean has_classless_route = FALSE;
|
||||
gboolean has_static_route = FALSE;
|
||||
const gint32 ts = nm_utils_get_monotonic_timestamp_sec();
|
||||
gint64 ts_time = time(NULL);
|
||||
struct in_addr a_address;
|
||||
struct in_addr a_netmask;
|
||||
struct in_addr a_next_server;
|
||||
struct in_addr server_id;
|
||||
struct in_addr broadcast;
|
||||
const struct in_addr * a_router;
|
||||
guint32 a_plen;
|
||||
guint32 a_lifetime;
|
||||
guint32 renewal;
|
||||
guint32 rebinding;
|
||||
gs_free nm_sd_dhcp_option *private_options = NULL;
|
||||
|
||||
nm_assert(lease != NULL);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue