mirror of
https://gitee.com/openharmony/third_party_libnl
synced 2024-11-30 13:40:43 +00:00
lib/route: potential memory leak in pktloc.c
In scneario, where file modification time is unchanged, code is returning 0 form read_pktlocs(). It causes memory leak for path variable. Memory for this variable is allocated inside build_sysconf_path() by asprintf() function. http://lists.infradead.org/pipermail/libnl/2015-December/002079.html Signed-off-by: Amit Khatri <amit.khatri@samsung.com> Signed-off-by: Rahul Jain <rahul.jain@samsung.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
parent
67683efd1d
commit
eccca1acfc
@ -101,8 +101,10 @@ static int read_pktlocs(void)
|
||||
/* if stat fails, just try to read the file */
|
||||
if (stat(path, &st) == 0) {
|
||||
/* Don't re-read file if file is unchanged */
|
||||
if (last_read == st.st_mtime)
|
||||
return 0;
|
||||
if (last_read == st.st_mtime) {
|
||||
err = 0;
|
||||
goto errout;
|
||||
}
|
||||
}
|
||||
|
||||
NL_DBG(2, "Reading packet location file \"%s\"\n", path);
|
||||
|
Loading…
Reference in New Issue
Block a user