]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ipc/ipcdev.git/blobdiff - linux/src/daemon/NameServer_daemon.c
Incorrect reference count management in NameServer_detach
[ipc/ipcdev.git] / linux / src / daemon / NameServer_daemon.c
index 56b21493d94f415ed9d2a431d77e870bbe3a3513..8d3643d4765e725d146b5f2228f25088ca580775 100644 (file)
@@ -1368,6 +1368,7 @@ Int NameServer_detach(UInt16 procId)
     /* procId already validated in API layer */
     clId = procId - MultiProc_getBaseIdOfCluster();
 
     /* procId already validated in API layer */
     clId = procId - MultiProc_getBaseIdOfCluster();
 
+    /* decrement reference count regardless of outcome below */
     if (--NameServer_module->comm[clId].refCount > 0) {
         goto done;
     }
     if (--NameServer_module->comm[clId].refCount > 0) {
         goto done;
     }
@@ -1387,16 +1388,13 @@ Int NameServer_detach(UInt16 procId)
     read(NameServer_module->waitFd, &event, sizeof(event));
 
     /* close the sending socket */
     read(NameServer_module->waitFd, &event, sizeof(event));
 
     /* close the sending socket */
-    LOG1("NameServer_destroy: closing socket: %d\n", sendSock)
+    LOG1("NameServer_detach: closing socket: %d\n", sendSock)
     close(sendSock);
 
     /* close the receiving socket */
     close(sendSock);
 
     /* close the receiving socket */
-    LOG1("NameServer_destroy: closing socket: %d\n", recvSock)
+    LOG1("NameServer_detach: closing socket: %d\n", recvSock)
     close(recvSock);
 
     close(recvSock);
 
-    /* decrement the reference count */
-    NameServer_module->comm[clId].refCount--;
-
 done:
     return (status);
 }
 done:
     return (status);
 }