[vlc-commits] messages: develop the final free() per logger

Rémi Denis-Courmont git at videolan.org
Wed Feb 27 18:02:59 CET 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Feb 27 18:15:05 2019 +0200| [fc558be98bb13ee490950209d38aefd681f80020] | committer: Rémi Denis-Courmont

messages: develop the final free() per logger

This removes a baroque static_assert().

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fc558be98bb13ee490950209d38aefd681f80020
---

 src/libvlc.c        | 1 +
 src/misc/messages.c | 6 +-----
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/libvlc.c b/src/libvlc.c
index 8e8d2ca8b2..98480ecc4d 100644
--- a/src/libvlc.c
+++ b/src/libvlc.c
@@ -429,6 +429,7 @@ void libvlc_InternalCleanup( libvlc_int_t *p_libvlc )
         config_AutoSaveConfigFile( VLC_OBJECT(p_libvlc) );
 
     vlc_LogDestroy(p_libvlc->obj.logger);
+    free(p_libvlc->obj.logger); /* transitional hack */
     /* Free module bank. It is refcounted, so we call this each time  */
     module_EndBank (true);
 #if defined(_WIN32) || defined(__OS2__)
diff --git a/src/misc/messages.c b/src/misc/messages.c
index f27316c223..55ac5803dd 100644
--- a/src/misc/messages.c
+++ b/src/misc/messages.c
@@ -483,7 +483,7 @@ static void vlc_vaLogHeader(void *d, int type, const vlc_log_t *item,
 
 static const struct vlc_logger_operations header_ops = {
     vlc_vaLogHeader,
-    NULL,
+    free,
 };
 
 struct vlc_logger *vlc_LogHeaderCreate(struct vlc_logger *parent,
@@ -494,8 +494,6 @@ struct vlc_logger *vlc_LogHeaderCreate(struct vlc_logger *parent,
     if (unlikely(header == NULL))
         return NULL;
 
-    static_assert (offsetof (struct vlc_logger_header, logger) == 0,
-                   "Bad free");
     header->logger.ops = &header_ops;
     header->logger.sys = header;
     header->parent = parent;
@@ -584,6 +582,4 @@ void vlc_LogDestroy(vlc_logger_t *logger)
 {
     if (logger->ops->destroy != NULL)
         logger->ops->destroy(logger->sys);
-
-    free(logger);
 }



More information about the vlc-commits mailing list