If primary process exits, there is no point in calling
pdump to release resources.

Bugzilla ID: 1760
Fixes: cbb44143be74 ("app/dumpcap: add new packet capture application")

Signed-off-by: Stephen Hemminger <step...@networkplumber.org>
---
 app/dumpcap/main.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/app/dumpcap/main.c b/app/dumpcap/main.c
index 3d3c0dbc66..df649722ec 100644
--- a/app/dumpcap/main.c
+++ b/app/dumpcap/main.c
@@ -541,7 +541,7 @@ monitor_primary(void *arg __rte_unused)
                rte_eal_alarm_set(MONITOR_INTERVAL, monitor_primary, NULL);
        } else {
                fprintf(stderr,
-                       "Primary process is no longer active, exiting...\n");
+                       "\nPrimary process is no longer active, exiting...\n");
                rte_atomic_store_explicit(&quit_signal, true, 
rte_memory_order_relaxed);
        }
 }
@@ -1058,10 +1058,11 @@ int main(int argc, char **argv)
        else
                pcap_dump_close(out.dumper);
 
-       cleanup_pdump_resources();
-
-       rte_ring_free(r);
-       rte_mempool_free(mp);
+       if (rte_eal_primary_proc_alive(NULL)) {
+           cleanup_pdump_resources();
+           rte_ring_free(r);
+           rte_mempool_free(mp);
+       }
 
        return rte_eal_cleanup() ? EXIT_FAILURE : 0;
 }
-- 
2.47.2

Reply via email to