libblock: Return RTEMS_NO_MEMORY on allocation failure

In rtems_bdpart_register(), when create_logical_disk_name() fails to
allocate memory and returns NULL, the error code variable 'esc' was
incorrectly assigned 'sc' (which evaluates to RTEMS_SUCCESSFUL).

This caused the function to falsely return RTEMS_SUCCESSFUL even when
memory allocation failed. Fix it by assigning RTEMS_NO_MEMORY.
This commit is contained in:
Yang Zhang
2026-08-03 10:08:40 +08:00
parent 6eb8a4a2f0
commit befb19c81f
+1 -1
View File
@@ -105,7 +105,7 @@ rtems_status_code rtems_bdpart_register(
&logical_disk_marker
);
if ( logical_disk_name == NULL ) {
esc = sc;
esc = RTEMS_NO_MEMORY;
goto cleanup;
}