Commit 5177ed40 authored by Ben Walker's avatar Ben Walker Committed by Daniel Verkamp
Browse files

blobfs: Handle request alloc failure during init/load



If the spdk_filesystem object is created but the initial
request allocation fails, correctly clean up. This
addresses a static analysis failure.

Change-Id: If47a380d8804a279ec92d2aee3de7d86bb5c67fa
Signed-off-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/369901


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent fe84b2eb
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -439,6 +439,12 @@ spdk_fs_init(struct spdk_bs_dev *dev, fs_send_request_fn send_request_fn,

	req = alloc_fs_request(fs->md_target.md_fs_channel);
	if (req == NULL) {
		spdk_put_io_channel(fs->md_target.md_io_channel);
		spdk_io_device_unregister(&fs->md_target);
		spdk_put_io_channel(fs->sync_target.sync_io_channel);
		spdk_io_device_unregister(&fs->sync_target);
		spdk_io_device_unregister(&fs->io_target);
		free(fs);
		cb_fn(cb_arg, NULL, -ENOMEM);
		return;
	}
@@ -559,6 +565,12 @@ spdk_fs_load(struct spdk_bs_dev *dev, fs_send_request_fn send_request_fn,

	req = alloc_fs_request(fs->md_target.md_fs_channel);
	if (req == NULL) {
		spdk_put_io_channel(fs->md_target.md_io_channel);
		spdk_io_device_unregister(&fs->md_target);
		spdk_put_io_channel(fs->sync_target.sync_io_channel);
		spdk_io_device_unregister(&fs->sync_target);
		spdk_io_device_unregister(&fs->io_target);
		free(fs);
		cb_fn(cb_arg, NULL, -ENOMEM);
		return;
	}