if (curr) kfree(curr); 
kfree(curr); 
void irlmp_expire_discoveries(hashbin_t *log, __u32 saddr, int force){	discovery_t *		discovery;	discovery_t *		curr;	unsigned long		flags;	discinfo_t *		buffer = NULL;	int			n;		/* Size of the full log */	int			i = 0;		/* How many we expired */	IRDA_ASSERT(log != NULL, return;);	IRDA_DEBUG(4, "%s()\n", __FUNCTION__);	spin_lock_irqsave(&log->hb_spinlock, flags);	discovery = (discovery_t *) hashbin_get_first(log);	while (discovery != NULL) {		/* Be sure to be one item ahead */		curr = discovery;		discovery = (discovery_t *) hashbin_get_next(log);		/* Test if it's time to expire this discovery */		if ((curr->data.saddr == saddr) &&		    (force ||		     ((jiffies - curr->timestamp) > DISCOVERY_EXPIRE_TIMEOUT)))		{			/* Create buffer as needed.			 * As this function get called a lot and most time			 * we don't have anything to put in the log (we are			 * quite picky), we can save a lot of overhead			 * by not calling kmalloc. Jean II */			if(buffer == NULL) {				/* Create the client specific buffer */				n = HASHBIN_GET_SIZE(log);				buffer = kmalloc(n * sizeof(struct irda_device_info), GFP_ATOMIC);				if (buffer == NULL) {					spin_unlock_irqrestore(&log->hb_spinlock, flags);					return;				}			}			/* Copy discovery information */			memcpy(&(buffer[i]), &(curr->data),			       sizeof(discinfo_t));			i++;			/* Remove it from the log */			curr = hashbin_remove_this(log, (irda_queue_t *) curr);			if (curr)				kfree(curr);		}	}	/* Drop the spinlock before calling the higher layers, as	 * we can't guarantee they won't call us back and create a	 * deadlock. We will work on our own private data, so we	 * don't care to be interupted. - Jean II */	spin_unlock_irqrestore(&log->hb_spinlock, flags);	if(buffer == NULL)		return;	/* Tell IrLMP and registered clients about it */	irlmp_discovery_expiry(buffer, i);	/* Free up our buffer */	kfree(buffer);}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/a51482bde22f99c63fbbb57d5d46cc666384e379/discovery.c/buggy/net/irda/discovery.c