projects
/
m6w6
/
libmemcached
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
|
github
raw
|
patch
| inline |
side by side
(parent:
4dbb184
)
bin/memcat: fix leak
author
Michael Wallner
<mike@php.net>
Tue, 10 Nov 2020 15:18:18 +0000
(16:18 +0100)
committer
Michael Wallner
<mike@php.net>
Tue, 10 Nov 2020 15:18:18 +0000
(16:18 +0100)
src/bin/memcat.cc
patch
|
blob
|
history
diff --git
a/src/bin/memcat.cc
b/src/bin/memcat.cc
index 50e213951e6f41029392c69999b2ce6c8ccbac6c..ca69d6f9f228528ed628993794769b74876e87fc 100644
(file)
--- a/
src/bin/memcat.cc
+++ b/
src/bin/memcat.cc
@@
-133,7
+133,6
@@
int main(int argc, char *argv[]) {
std::cout.write(string, string_length);
std::cout << std::endl;
}
- free(string);
}
} else if (rc != MEMCACHED_NOTFOUND) {
std::cerr << "error on " << argv[optind] << "(" << memcached_strerror(memc, rc) << ")";
@@
-152,6
+151,11
@@
int main(int argc, char *argv[]) {
return_code = EXIT_FAILURE;
}
optind++;
+ free(string);
+ string = nullptr;
+ }
+ if (string) {
+ free(string);
}
memcached_free(memc);