nslookup: fix output corruption for "nslookup 1.2.3.4"
authorDenys Vlasenko <vda.linux@googlemail.com>
Sat, 14 Apr 2018 21:18:34 +0000 (23:18 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sat, 14 Apr 2018 21:18:34 +0000 (23:18 +0200)
function                                             old     new   delta
nslookup_main                                       1832    1837      +5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
networking/nslookup.c

index feeec15aa4c204cf96cbe1e8c487f5b0fac971b7..92e07e8b1f1cbd60e559a6719b2a22ea6fb40125 100644 (file)
@@ -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);