projects
/
tinc
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
49edf9c
)
Fix potential memory leaks found by the Clang static analyzer.
author
Guus Sliepen
<guus@tinc-vpn.org>
Thu, 23 Jun 2016 13:59:43 +0000
(15:59 +0200)
committer
Guus Sliepen
<guus@tinc-vpn.org>
Thu, 23 Jun 2016 13:59:43 +0000
(15:59 +0200)
src/tincctl.c
patch
|
blob
|
history
diff --git
a/src/tincctl.c
b/src/tincctl.c
index
a0a7633
..
465c981
100644
(file)
--- a/
src/tincctl.c
+++ b/
src/tincctl.c
@@
-2521,6
+2521,7
@@
static int cmd_verify(int argc, char *argv[]) {
char *newline = memchr(data, '\n', len);
if(!newline || (newline - data > MAX_STRING_SIZE - 1)) {
fprintf(stderr, "Invalid input\n");
char *newline = memchr(data, '\n', len);
if(!newline || (newline - data > MAX_STRING_SIZE - 1)) {
fprintf(stderr, "Invalid input\n");
+ free(data);
return 1;
}
return 1;
}
@@
-2533,11
+2534,13
@@
static int cmd_verify(int argc, char *argv[]) {
if(sscanf(data, "Signature = %s %ld %s", signer, &t, sig) != 3 || strlen(sig) != 86 || !t || !check_id(signer)) {
fprintf(stderr, "Invalid input\n");
if(sscanf(data, "Signature = %s %ld %s", signer, &t, sig) != 3 || strlen(sig) != 86 || !t || !check_id(signer)) {
fprintf(stderr, "Invalid input\n");
+ free(data);
return 1;
}
if(node && strcmp(node, signer)) {
fprintf(stderr, "Signature is not made by %s\n", node);
return 1;
}
if(node && strcmp(node, signer)) {
fprintf(stderr, "Signature is not made by %s\n", node);
+ free(data);
return 1;
}
return 1;
}
@@
-2831,8
+2834,10
@@
static int cmd_shell(int argc, char *argv[]) {
if(nargc == argc)
continue;
if(nargc == argc)
continue;
- if(!strcasecmp(nargv[argc], "exit") || !strcasecmp(nargv[argc], "quit"))
+ if(!strcasecmp(nargv[argc], "exit") || !strcasecmp(nargv[argc], "quit")) {
+ free(nargv);
return result;
return result;
+ }
bool found = false;
bool found = false;