diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index dc93960e5e..afef8ea435 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -142,6 +142,12 @@ class gtpEndPoints { pthread_mutex_t gtp_lock=PTHREAD_MUTEX_INITIALIZER; // the instance id will be the Linux socket handler, as this is uniq map instances; + + ~gtpEndPoints() { + // automatically close all sockets on quit + for (const auto p : instances) + close(p.first); + } }; gtpEndPoints globGtp;