diff options
author | Thomas Haller <thaller@redhat.com> | 2016-04-20 11:50:45 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-04-20 12:09:40 +0200 |
commit | b103af0f1ed2e25fd441177d18909af10c724875 (patch) | |
tree | de5d32c03f61c13ded0956528b940720d803642f | |
parent | 9c323261ea15fb8162c9ce3f7db39e8049b0f5f8 (diff) | |
download | NetworkManager-b103af0f1ed2e25fd441177d18909af10c724875.tar.gz |
platform: stack allocate string buffers in _infiniband_partition_action()
-rw-r--r-- | src/platform/nm-linux-platform.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c index 529d1dd2d1..e06aa4607a 100644 --- a/src/platform/nm-linux-platform.c +++ b/src/platform/nm-linux-platform.c @@ -5104,8 +5104,8 @@ _infiniband_partition_action (NMPlatform *platform, int parent, int p_key, const { NMLinuxPlatformPrivate *priv = NM_LINUX_PLATFORM_GET_PRIVATE (platform); const NMPObject *obj_parent; - gs_free char *path = NULL; - gs_free char *id = NULL; + char path[NM_STRLEN ("/sys/class/net/%s/%s") + IFNAMSIZ + 100]; + char id[20]; nm_assert (p_key > 0 && p_key <= 0xffff && p_key != 0x8000); @@ -5118,11 +5118,11 @@ _infiniband_partition_action (NMPlatform *platform, int parent, int p_key, const if (out_partition_name) nm_utils_new_infiniband_name (out_partition_name, obj_parent->link.name, p_key); - path = g_strdup_printf ("/sys/class/net/%s/%s", - NM_ASSERT_VALID_PATH_COMPONENT (obj_parent->link.name), - action); - id = g_strdup_printf ("0x%04x", p_key); - + nm_sprintf_buf (path, + "/sys/class/net/%s/%s", + NM_ASSERT_VALID_PATH_COMPONENT (obj_parent->link.name), + action); + nm_sprintf_buf (id, "0x%04x", p_key); return nm_platform_sysctl_set (platform, path, id); } |