[vlc-devel] [PATCH] avahi: remove useless avahi_threaded_poll_stop() from error path

Petri Hintukainen phintuka at gmail.com
Wed Mar 9 11:43:04 CET 2016


On ti, 2016-03-08 at 16:26 +0100, Jean-Baptiste Kempf wrote:
> On 08 Mar, Petri Hintukainen wrote :
> > Error path is never triggered after avahi_threaded_poll_start().
> 
> Right.
> 
> > Even if it was, thread should probably be stopped before freeing
> > avahi client ... ?
> 
> Not so sure about that, tbh.

I'm not sure either. But it kind of makes sense to stop the thread
before freeing data it may access. If avahi_client_free() is called
while callback is running, callback may access already freed memory.

This is how it is in the example ( 
http://avahi.org/wiki/RunningAvahiClientAsThread ):

void zeroconf_shutdown(void) {
  /* Call this when the app shuts down */

  avahi_threaded_poll_stop(threaded_poll);
  avahi_client_free(client);
  avahi_threaded_poll_free(threaded_poll);
}




- Petri


More information about the vlc-devel mailing list