From 5491fe2ae4cb681304e190821cf830db8b1005b7 Mon Sep 17 00:00:00 2001 From: vs Date: Mon, 15 Jun 2009 00:24:03 +0000 Subject: [PATCH] b=19593 i=maxim fix memory leak in error handling of ptlrpc_init() --- lustre/ptlrpc/ptlrpc_module.c | 2 +- lustre/ptlrpc/service.c | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) 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) -- 1.8.3.1