Re: [PATCH] btrfs-progs: avoid memory leak in btrfs_close_devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 25, 2013 at 09:02:13PM +0800, Wang Sheng-Hui wrote:
> +static void btrfs_close_device(struct btrfs_device *device)
> +{
> +	close(device->fd);
> +	device->fd = -1;
> +	device->writeable = 0;

It's not necessary to set these variables when we're freeing the
structure immediatelly.

> +	if (device->name)
> +		kfree(device->name);
> +	kfree(device);
> +}

david
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux