Whamcloud - gitweb
b=19593
authorvs <vs>
Mon, 15 Jun 2009 00:24:03 +0000 (00:24 +0000)
committervs <vs>
Mon, 15 Jun 2009 00:24:03 +0000 (00:24 +0000)
i=maxim

fix memory leak in error handling of ptlrpc_init()

lustre/ptlrpc/ptlrpc_module.c
lustre/ptlrpc/service.c

index fe75eb9..92deb8b 100644 (file)
@@ -80,7 +80,7 @@ __init int ptlrpc_init(void)
 
         rc = ptlrpc_init_portals();
         if (rc)
-                RETURN(rc);
+                GOTO(cleanup, rc);
         cleanup_phase = 2;
 
         rc = ptlrpc_connection_init();
index 3eb247f..ba0dffa 100644 (file)
@@ -2287,6 +2287,7 @@ int ptlrpc_hr_init(void)
         int n_cpus = num_online_cpus();
         struct ptlrpc_hr_service *hr;
         int size;
+        int rc;
         ENTRY;
 
         LASSERT(ptlrpc_hr == NULL);
@@ -2307,7 +2308,12 @@ int ptlrpc_hr_init(void)
         hr->hr_size = size;
         ptlrpc_hr = hr;
 
-        RETURN(ptlrpc_start_hr_threads(hr));
+        rc = ptlrpc_start_hr_threads(hr);
+        if (rc) {
+                OBD_FREE(hr, hr->hr_size);
+                ptlrpc_hr = NULL;
+        }
+        RETURN(rc);
 }
 
 void ptlrpc_hr_fini(void)