[openib-general] [PATCH]small cleanup in cache.c

Shirley Ma xma at us.ibm.com
Wed Oct 5 08:54:37 PDT 2005


The first time ib_cache_update being called both old_pkey_cache & 
old_gid_cache are NULL.

Signed-off-by: Shirley Ma (xma at us.ibm.com)

diff -uprN infiniband/core/cache.c infiniband-patch/core/cache.c
--- infiniband/core/cache.c     2005-10-05 06:59:34.000000000 -0700
+++ infiniband-patch/core/cache.c       2005-10-05 08:55:42.550693304 
-0700
@@ -252,8 +252,10 @@ static void ib_cache_update(struct ib_de
 
        write_unlock_irq(&device->cache.lock);
 
-       kfree(old_pkey_cache);
-       kfree(old_gid_cache);
+       if (old_pkey_cache)
+               kfree(old_pkey_cache);
+       if (old_gid_cache)
+               kfree(old_gid_cache);
        kfree(tprops);
        return;
 



Shirley Ma
IBM Linux Technology Center
15300 SW Koll Parkway
Beaverton, OR 97006-6063
Phone(Fax): (503) 578-7638

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20051005/8e15f724/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: freecache.patch
Type: application/octet-stream
Size: 522 bytes
Desc: not available
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20051005/8e15f724/attachment.obj>


More information about the general mailing list