Commit ef849696 authored by Tomasz Zawadzki's avatar Tomasz Zawadzki
Browse files

lib/accel: free override opcode before another assignment



Calling accel_assign_opc RPC twice for the same operation
resulted in replacing it, but did not free the string
for this operation. Leading to a memleak.

Signed-off-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I339b922d92b6654ce0f0d0e066a1347c565ac408
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/21184


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarSlawomir Ptak <slawomir.ptak@intel.com>
parent 1b1a6ba7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -260,6 +260,7 @@ spdk_accel_assign_opc(enum spdk_accel_opcode opcode, const char *name)
	}

	/* module selection will be validated after the framework starts. */
	free(g_modules_opc_override[opcode]);
	g_modules_opc_override[opcode] = copy;

	return 0;
+3 −0
Original line number Diff line number Diff line
@@ -26,6 +26,9 @@ function accel_scan_dsa_modules_test_suite() {
# assignments to modules before starting the framework.
# Should PASS - opcode assignments can be verified after starting the framework.
function accel_assign_opcode_test_suite() {
	# Assign opc twice, to test replacing the assignment
	$rpc_py accel_assign_opc -o copy -m incorrect

	$rpc_py accel_assign_opc -o copy -m software
	$rpc_py framework_start_init
	$rpc_py accel_get_opc_assignments | jq -r '.copy' | grep software