Commit 88c9e0c4 authored by kyuho.son's avatar kyuho.son Committed by Tomasz Zawadzki
Browse files

nvmf: fix duplicate service registration and memory leak in mdns_server



Previously, when multiple listeners were used, the Avahi service string list
from one listener was appended to subsequent listeners' string lists. This
caused unintended service strings to be registered in the service group
for each additional listener.

This patch corrects the issue by properly initializing the Avahi string list
each time it is added to the entry group, ensuring that only the correct
service strings are registered.

Additionally, this update addresses a memory leak by deallocating the memory
used for the Avahi string list after it is no longer needed.

Fixes #3407

Change-Id: I4e28dce4464c69e017e6e9b44127b4ab54510da3
Signed-off-by: default avatarkyuho.son <kyuho.son@samsung.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/23923


Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
parent 400e0caf
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -149,8 +149,9 @@ publish_pull_registration_request(AvahiClient *client, struct mdns_publish_ctx *
				0, name, type, domain, NULL, port, txt) < 0) {
			SPDK_ERRLOG("Failed to add avahi service name: %s, type: %s, domain: %s, port: %d, error: %s\n",
				    name, type, domain, port, avahi_strerror(avahi_client_errno(client)));
			continue;
		}
		avahi_string_list_free(txt);
		txt = NULL;
	}

	avahi_entry_group_commit(g_avahi_entry_group);