This is an automated email from the ASF dual-hosted git repository.

ccollins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newtmgr.git


The following commit(s) were added to refs/heads/master by this push:
     new 56ff2a0  omp: Don't dereference nil pointer
56ff2a0 is described below

commit 56ff2a0c2af91ece86c7666ee7945df074e73ce8
Author: Christopher Collins <ccoll...@apache.org>
AuthorDate: Tue Oct 1 10:53:29 2019 -0700

    omp: Don't dereference nil pointer
---
 nmxact/omp/dispatch.go | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/nmxact/omp/dispatch.go b/nmxact/omp/dispatch.go
index 3708e66..cab7a79 100644
--- a/nmxact/omp/dispatch.go
+++ b/nmxact/omp/dispatch.go
@@ -171,11 +171,13 @@ func (d *Dispatcher) RemoveNmpListener(seq uint8) 
*nmp.Listener {
        defer d.mtx.Unlock()
 
        ompl := d.seqListenerMap[seq]
-       if ompl != nil {
-               delete(d.seqListenerMap, seq)
-               close(ompl.stopCh)
+       if ompl == nil {
+               return nil
        }
 
+       delete(d.seqListenerMap, seq)
+       close(ompl.stopCh)
+
        nmxutil.LogRemoveNmpListener(d.logDepth, seq)
        return ompl.nmpl
 }

Reply via email to