projects
/
platform
/
upstream
/
libabigail.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5448828
)
Fix a memory leak in real_path
author
Dodji Seketeli
<dodji@redhat.com>
Thu, 18 Apr 2019 09:18:31 +0000
(11:18 +0200)
committer
Dodji Seketeli
<dodji@redhat.com>
Thu, 18 Apr 2019 09:18:31 +0000
(11:18 +0200)
Running the testsuite with AddressSanitizer turned on flagged a memory
leak in real_path, in abg-tools-utils.cc.
Fixed thus.
* src/abg-tools-utils.cc (real_path): Fee the returned pointer of
realpath.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
src/abg-tools-utils.cc
patch
|
blob
|
history
diff --git
a/src/abg-tools-utils.cc
b/src/abg-tools-utils.cc
index 58fe985e299b55d1b2f34b1af807f48c34f98ff3..9040a44a6c39d94e4c8073a00955cbddb0d8bf6c 100644
(file)
--- a/
src/abg-tools-utils.cc
+++ b/
src/abg-tools-utils.cc
@@
-405,7
+405,10
@@
real_path(const string&path, string& result)
char *realp = realpath(path.c_str(), NULL);
if (realp)
- result = realp;
+ {
+ result = realp;
+ free(realp);
+ }
}
/// Ensures #dir_path is a directory and is created. If #dir_path is