- When working with deeply nested imports, compile errors led to long error messages or complete hangs by compiling the same module over and over again. - Fix for a function expression scope issue. Signed-off-by: Felix Fietkau <nbd@nbd.name>
32 lines
772 B
Diff
32 lines
772 B
Diff
From: Felix Fietkau <nbd@nbd.name>
|
|
Date: Tue, 7 Jul 2026 09:34:16 +0200
|
|
Subject: [PATCH] lib: avoid allocating print buffer before NULL check in
|
|
uc_error_message_indent
|
|
|
|
Move the print buffer allocation after the guard that returns early on a
|
|
NULL message, so no buffer is allocated on that path. This keeps the
|
|
function leak-free when callers invoke it without having produced an error
|
|
string.
|
|
|
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
---
|
|
|
|
--- a/lib.c
|
|
+++ b/lib.c
|
|
@@ -220,13 +220,14 @@ uc_error_context_format(uc_stringbuf_t *
|
|
|
|
void
|
|
uc_error_message_indent(char **msg) {
|
|
- uc_stringbuf_t *buf = xprintbuf_new();
|
|
+ uc_stringbuf_t *buf;
|
|
char *s, *p, *nl;
|
|
size_t len;
|
|
|
|
if (!msg || !*msg)
|
|
return;
|
|
|
|
+ buf = xprintbuf_new();
|
|
s = *msg;
|
|
len = strlen(s);
|
|
|