Bugzilla Bug 337637: fixed a memory leak on error in _MD_OpenSharedMemory.
authorwtchang%redhat.com
Tue, 12 Sep 2006 17:58:53 +0000
changeset 3691 691d18545853a07ed2451f2344d4197535cee7c1
parent 3681 d78838abf963474ff4ea8822451534499420f533
child 3693 6bb17dd81ceeda2bd2fd66806a397a62c9b54a95
push idunknown
push userunknown
push dateunknown
bugs337637
Bugzilla Bug 337637: fixed a memory leak on error in _MD_OpenSharedMemory. The patch is contributed by Bruno 'Aqualon' Escherl <aqualon@aquachan.de>. r=wtc.
pr/src/md/unix/uxshm.c
--- a/pr/src/md/unix/uxshm.c
+++ b/pr/src/md/unix/uxshm.c
@@ -97,16 +97,17 @@ extern PRSharedMemory * _MD_OpenSharedMe
         return( NULL );
     }
 
     shm->ipcname = (char*)PR_MALLOC( strlen( ipcname ) + 1 );
     if ( NULL == shm->ipcname )
     {
         PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0 );
         PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, ( "PR_OpenSharedMemory: New shm->ipcname out of memory")); 
+        PR_DELETE( shm );
         return( NULL );
     }
 
     /* copy args to struct */
     strcpy( shm->ipcname, ipcname );
     shm->size = size; 
     shm->mode = mode; 
     shm->flags = flags;