diff options
author | Thomas Haller <thaller@redhat.com> | 2019-11-27 10:27:00 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-11-27 11:41:53 +0100 |
commit | 3ade6dacfc44673aff812ecafc0830ae42334840 (patch) | |
tree | dc62ebd5feb573cd148ca4b429927c226c21d08f /dispatcher | |
parent | 1c2889faeeae87abff5cf767b82ed95f206a42c8 (diff) | |
download | NetworkManager-3ade6dacfc44673aff812ecafc0830ae42334840.tar.gz |
dispatcher: use free() to free memory allocated with malloc()
In practice, nowadays g_free() is the same as free(), so there is no
difference. However, we still should not mix the two and use free()
for data that was allocated with malloc() -- in this case, the memory
was allocated by libc's realpath().
Diffstat (limited to 'dispatcher')
-rw-r--r-- | dispatcher/nm-dispatcher.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/dispatcher/nm-dispatcher.c b/dispatcher/nm-dispatcher.c index a2d8cf898a..0bc2e9fb3e 100644 --- a/dispatcher/nm-dispatcher.c +++ b/dispatcher/nm-dispatcher.c @@ -638,14 +638,15 @@ static gboolean script_must_wait (const char *path) { gs_free char *link = NULL; - gs_free char *dir = NULL; - gs_free char *real = NULL; - char *tmp; - link = g_file_read_link (path, NULL); if (link) { + gs_free char *dir = NULL; + nm_auto_free char *real = NULL; + if (!g_path_is_absolute (link)) { + char *tmp; + dir = g_path_get_dirname (path); tmp = g_build_path ("/", dir, link, NULL); g_free (link); |