[vlc-commits] tls: add vlc_objres_clear() on error
Rémi Denis-Courmont
git at videolan.org
Mon Mar 4 21:05:39 CET 2019
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Mar 4 20:55:36 2019 +0200| [776c2aebf815cdecb13bdcf3cfb473252369f306] | committer: Rémi Denis-Courmont
tls: add vlc_objres_clear() on error
To balance out the one on success.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=776c2aebf815cdecb13bdcf3cfb473252369f306
---
src/network/tls.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/network/tls.c b/src/network/tls.c
index 55b40f1423..305b73cd05 100644
--- a/src/network/tls.c
+++ b/src/network/tls.c
@@ -53,8 +53,11 @@ static int tls_server_load(void *func, bool forced, va_list ap)
const char *cert = va_arg (ap, const char *);
const char *key = va_arg (ap, const char *);
+ int ret = activate (crd, cert, key);
+ if (ret)
+ vlc_objres_clear(VLC_OBJECT(crd));
(void) forced;
- return activate (crd, cert, key);
+ return ret;
}
static int tls_client_load(void *func, bool forced, va_list ap)
@@ -62,8 +65,11 @@ static int tls_client_load(void *func, bool forced, va_list ap)
int (*activate)(vlc_tls_client_t *) = func;
vlc_tls_client_t *crd = va_arg(ap, vlc_tls_client_t *);
+ int ret = activate (crd);
+ if (ret)
+ vlc_objres_clear(VLC_OBJECT(crd));
(void) forced;
- return activate (crd);
+ return ret;
}
vlc_tls_server_t *
More information about the vlc-commits
mailing list