[PATCH 0/2] iputils: minor fixes

STALE5026d

4 messages, 2 authors, 2012-11-14 · open the first message on its own page

[PATCH 0/2] iputils: minor fixes

From: Jan Synacek <hidden>
Date: 2012-11-14 12:57:45

Jan Synacek (2):
  ping,ping6: Add newline to error message.
  ping: Don't free an unintialized value.

 ping.c        | 8 +++++---
 ping_common.c | 2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

-- 
1.7.11.7

[PATCH 1/2] ping,ping6: Add newline to error message.

From: Jan Synacek <hidden>
Date: 2012-11-14 12:57:51

---
 ping_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ping_common.c b/ping_common.c
index 86dbeaa..1605ca9 100644
--- a/ping_common.c
+++ b/ping_common.c
@@ -265,7 +265,7 @@ void common_options(int ch)
 		char *endp;
 		mark = (int)strtoul(optarg, &endp, 10);
 		if (mark < 0 || *endp != '\0') {
-			fprintf(stderr, "mark cannot be negative");
+			fprintf(stderr, "mark cannot be negative\n");
 			exit(2);
 		}
 		options |= F_MARK;
-- 
1.7.11.7

[PATCH 2/2] ping: Don't free an unintialized value.

From: Jan Synacek <hidden>
Date: 2012-11-14 12:57:55

---
 ping.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/ping.c b/ping.c
index fe9ff8a..9de3d08 100644
--- a/ping.c
+++ b/ping.c
@@ -122,7 +122,7 @@ main(int argc, char **argv)
 	u_char *packet;
 	char *target;
 #ifdef USE_IDN
-	char *hnamebuf;
+	char *hnamebuf = NULL;
 #else
 	char hnamebuf[MAX_HOSTNAMELEN];
 #endif
@@ -263,8 +263,10 @@ main(int argc, char **argv)
 #ifdef USE_IDN
 			int rc;
 
-			free(hnamebuf);
-			hnamebuf = NULL;
+			if (hnamebuf) {
+				free(hnamebuf);
+				hnamebuf = NULL;
+			}
 
 			rc = idna_to_ascii_lz(target, &idn, 0);
 			if (rc != IDNA_SUCCESS) {
-- 
1.7.11.7

Re: [PATCH 0/2] iputils: minor fixes

From: YOSHIFUJI Hideaki <hidden>
Date: 2012-11-14 15:23:37

Jan Synacek wrote:
Jan Synacek (2):
  ping,ping6: Add newline to error message.
  ping: Don't free an unintialized value.
Both applied and pushed into public tree.
Thank you.

--yoshfuji
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help