From: vs Date: Mon, 15 Jun 2009 00:24:03 +0000 (+0000) Subject: b=19593 X-Git-Tag: v1_9_220~148 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=5491fe2ae4cb681304e190821cf830db8b1005b7;p=fs%2Flustre-release.git b=19593 i=maxim fix memory leak in error handling of ptlrpc_init() --- diff --git a/lustre/ptlrpc/ptlrpc_module.c b/lustre/ptlrpc/ptlrpc_module.c index fe75eb9..92deb8b 100644 --- a/lustre/ptlrpc/ptlrpc_module.c +++ b/lustre/ptlrpc/ptlrpc_module.c @@ -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(); diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index 3eb247f..ba0dffa 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -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)