[PATCH] canonicalize: Fix uninitialized 'dest' in realpath_stk for glibc 2.35 [BZ #32577]
Nikhil R
nikhilar2410@gmail.com
Mon Jan 20 12:25:30 GMT 2025
Fixes a GCC warning when compiling with the '-Os' optimization flag:
| canonicalize.c: In function 'realpath_stk':
| canonicalize.c:424:50: error: 'dest' may be used uninitialized in this function [-Werror=maybe-uninitialized]
| 424 | return scratch_buffer_dupfree (rname_buf, dest - rname);
Issue specific to glibc 2.35.
Signed-off-by: Nikhil R <nikhilar2410@gmail.com>
---
stdlib/canonicalize.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/stdlib/canonicalize.c b/stdlib/canonicalize.c
index 6caed9e70e..061d3b3062 100644
--- a/stdlib/canonicalize.c
+++ b/stdlib/canonicalize.c
@@ -198,7 +198,7 @@ static char *
realpath_stk (const char *name, char *resolved,
struct scratch_buffer *rname_buf)
{
- char *dest;
+ char *dest = NULL;
char const *start;
char const *end;
int num_links = 0;
--
2.17.1
More information about the Libc-alpha
mailing list