Whamcloud - gitweb
- Report any leaked memory at module remove time
authorpschwan <pschwan>
Wed, 6 Mar 2002 20:53:13 +0000 (20:53 +0000)
committerpschwan <pschwan>
Wed, 6 Mar 2002 20:53:13 +0000 (20:53 +0000)
- 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!

lustre/obdclass/class_obd.c
lustre/ptlrpc/client.c

index 4e8b6d0..d575f8d 100644 (file)
@@ -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;
 }
index 8fc5669..12dbb15 100644 (file)
@@ -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));
 }