projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix warnings from the Clang static analyzer.
[tinc]
/
src
/
tincctl.c
diff --git
a/src/tincctl.c
b/src/tincctl.c
index
2fdab2a
..
4f6660a
100644
(file)
--- a/
src/tincctl.c
+++ b/
src/tincctl.c
@@
-2151,7
+2151,7
@@
static bool try_bind(int port) {
return success;
}
return success;
}
-int check_port(char *name) {
+int check_port(c
onst c
har *name) {
if(try_bind(655)) {
return 655;
}
if(try_bind(655)) {
return 655;
}
@@
-3175,10
+3175,7
@@
static int cmd_shell(int argc, char *argv[]) {
free(line);
rl_basic_word_break_characters = "\t\n ";
line = readline(prompt);
free(line);
rl_basic_word_break_characters = "\t\n ";
line = readline(prompt);
-
- if(line) {
- copy = xstrdup(line);
- }
+ copy = line ? xstrdup(line) : NULL;
} else {
line = fgets(buf, sizeof(buf), stdin);
}
} else {
line = fgets(buf, sizeof(buf), stdin);
}
@@
-3224,6
+3221,9
@@
static int cmd_shell(int argc, char *argv[]) {
}
if(!strcasecmp(nargv[argc], "exit") || !strcasecmp(nargv[argc], "quit")) {
}
if(!strcasecmp(nargv[argc], "exit") || !strcasecmp(nargv[argc], "quit")) {
+#ifdef HAVE_READLINE
+ free(copy);
+#endif
free(nargv);
return result;
}
free(nargv);
return result;
}
@@
-3252,6
+3252,9
@@
static int cmd_shell(int argc, char *argv[]) {
}
}
}
}
+#ifdef HAVE_READLINE
+ free(copy);
+#endif
free(nargv);
if(tty) {
free(nargv);
if(tty) {