font: logf: fix pointer in buflibmove_callback

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]>
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit 3da69af83cc73098ff7bab5e09cdbbf747f0f69a
Author: Christian Soffke <[email protected]>
Date:   Sat Jan 10 07:11:51 2026 +0100

    font: logf: fix pointer in buflibmove_callback
    
    Buffer contents are only moved after the callback
    returns, so we need to log the path before it has
    been updated to prevent reading garbage.
    
    Change-Id: I187fbd56484249c456155ffcbdde9e44e766dde8

diff --git a/firmware/font.c b/firmware/font.c
index 0f11ea5a0a..689445692b 100644
--- a/firmware/font.c
+++ b/firmware/font.c
@@ -121,6 +121,7 @@ static int buflibmove_callback(int handle, void* current, void* new)
     struct buflib_alloc_data *alloc = (struct buflib_alloc_data*)current;
     ptrdiff_t diff = new - current;
 
+    logf("%s %s", __func__, alloc->path);
 #define UPDATE(x) if (x) { x = PTR_ADD(x, diff); }
 
     UPDATE(alloc->font.bits);
@@ -134,7 +135,6 @@ static int buflibmove_callback(int handle, void* current, void* new)
 
     UPDATE(alloc->font.cache._index);
     UPDATE(alloc->font.cache._lru._base);
-    logf("%s %s", __func__, alloc->path);
     return BUFLIB_CB_OK;
 }
 static void lock_font_handle(int handle, bool lock)
-- 
rockbox-cvs mailing list
[email protected]
https://lists.haxx.se/mailman/listinfo/rockbox-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.