jbagg / QtZeroConf

Qt wrapper class for ZeroConf libraries across various platforms.
Other
69 stars 51 forks source link

Avahi Implementation: Fix double-free on errors in GROUP_UNCOMMITED s… #20

Closed strfry closed 6 years ago

strfry commented 6 years ago

groupCallback is called with AVAHI_ENTRY_GROUP_UNCOMMITED during the groups creation by avahi_entry_group_new. Unfortunately, inside is no way to signal back to avahi-client that there has been a problem and that the group has been be destroyed. So after we set ref->group = NULL, it will still be assigned later after avahi_entry_group_new returns, leading to crashes. The documentation even mentions this trap: (though the example is the other way around) https://www.avahi.org/doxygen/html/publish_8h.html#abb17598f2b6ec3c3f69defdd488d568c Maybe AVAHI_ENTRY_GROUP_UNCOMMITED shouldn't really be used for anything...

I'm glad i figured this out now after way too many hours of debugging ;) It's unknown to me why avahi_entry_group_add_service_strlst failed in the first place, will investigate that next.

jbagg commented 6 years ago

I think this is ok. It is similar to how it is done in the avahi-core wrapper.