From: pschwan Date: Wed, 6 Mar 2002 20:53:13 +0000 (+0000) Subject: - Report any leaked memory at module remove time X-Git-Tag: 0.4.2~557 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=b9fc45dd0e6c70860a903f64b23b2abf13965195;p=fs%2Flustre-release.git - Report any leaked memory at module remove time - Free the reply buffer when we destroy the request, thus avoiding the double-free. If we ever move to an event model where we don't put the ptlrpc_main() request on the stack, be careful that we don't free an outgoing reply buffer before it's sent! --- diff --git a/lustre/obdclass/class_obd.c b/lustre/obdclass/class_obd.c index 4e8b6d0..d575f8d 100644 --- a/lustre/obdclass/class_obd.c +++ b/lustre/obdclass/class_obd.c @@ -840,7 +840,8 @@ static void __exit cleanup_obdclass(void) obd_cleanup_obdo_cache(); obd_sysctl_clean(); - CDEBUG(D_MALLOC, "CLASS mem used %ld\n", obd_memory); + if (obd_memory) + CERROR("obd memory leaked: %ld bytes\n", obd_memory); obd_init_magic = 0; EXIT; } diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index 8fc5669..12dbb15 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -157,6 +157,8 @@ struct ptlrpc_request *ptlrpc_prep_req(struct ptlrpc_client *cl, void ptlrpc_free_req(struct ptlrpc_request *request) { + if (request->rq_repbuf != NULL) + OBD_FREE(request->rq_repbuf, request->rq_replen); OBD_FREE(request, sizeof(*request)); }