From 4e73c0f659738f141583bbf92b3df5346d5fb3c0 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sat, 14 Apr 2018 23:18:34 +0200 Subject: [PATCH] nslookup: fix output corruption for "nslookup 1.2.3.4" function old new delta nslookup_main 1832 1837 +5 Signed-off-by: Denys Vlasenko --- networking/nslookup.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/networking/nslookup.c b/networking/nslookup.c index feeec15aa..92e07e8b1 100644 --- a/networking/nslookup.c +++ b/networking/nslookup.c @@ -797,11 +797,9 @@ int nslookup_main(int argc UNUSED_PARAM, char **argv) char buf80[80]; ptr = make_ptr(buf80, *argv); - if (ptr) { - add_query(&queries, &n_queries, T_PTR, ptr); - } - else { + add_query(&queries, &n_queries, T_PTR, xstrdup(ptr)); + } else { add_query(&queries, &n_queries, T_A, *argv); #if ENABLE_FEATURE_IPV6 add_query(&queries, &n_queries, T_AAAA, *argv);