From: RĂ©mi Denis-Courmont Date: Sun, 22 May 2005 07:46:02 +0000 (+0000) Subject: Fix httpd reference count and deletion X-Git-Tag: 0.8.2~144 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=2280a7d887aafe4e6887c752a3a79a6137585ea9;p=vlc Fix httpd reference count and deletion --- diff --git a/src/misc/httpd.c b/src/misc/httpd.c index 632e56108e..f050cfe921 100644 --- a/src/misc/httpd.c +++ b/src/misc/httpd.c @@ -1173,6 +1173,12 @@ socket_error: return host; error: + if( httpd->i_host <= 0 ) + { + vlc_object_release( httpd ); + vlc_object_detach( httpd ); + vlc_object_destroy( httpd ); + } vlc_mutex_unlock( lockval.p_address ); if( fd != -1 ) @@ -1184,8 +1190,6 @@ error: vlc_object_destroy( host ); } - /* TODO destroy no more used httpd TODO */ - vlc_object_release( httpd ); return NULL; } @@ -1201,8 +1205,6 @@ void httpd_HostDelete( httpd_host_t *host ) var_Get( httpd->p_libvlc, "httpd_mutex", &lockval ); vlc_mutex_lock( lockval.p_address ); - vlc_object_release( httpd ); - host->i_ref--; if( host->i_ref > 0 ) { @@ -1244,6 +1246,7 @@ void httpd_HostDelete( httpd_host_t *host ) if( httpd->i_host <= 0 ) { msg_Info( httpd, "httpd doesn't reference any host, deleting" ); + vlc_object_release( httpd ); vlc_object_detach( httpd ); vlc_object_destroy( httpd ); }