If allocation for disk fails, then we leak memory from previously
called _new_device function.
This patch based on D12223 from akanad (Wonki Kim)
ref D12223
Change-Id: If22a28d99a6b91eadc1b82103daabf92db515923
if (!(disk = calloc(1, sizeof(Eeze_Disk))))
- return NULL;
+ {
+ eina_stringshare_del(syspath);
+ udev_device_unref(dev);
+ return NULL;
+ }
if (is_dev)
else
disk->syspath = eina_stringshare_add(udev_device_get_syspath(dev));
-
disk->device = dev;
disk->mount_opts = EEZE_DISK_MOUNTOPT_DEFAULTS;
disk->mount_cmd_changed = EINA_TRUE;