On 14/03/18 14:43, Andrew Gregory wrote:
> On 03/14/18 at 01:44pm, Allan McRae wrote:
>> Add a suppression to avoid this error from valgrind:
>>
>> ==28835== Conditional jump or move depends on uninitialised value(s)
>> ==28835==    at 0x57704E8: __gconv_transform_internal_ascii (in 
>> /usr/lib/libc-2.26.so)
>> ==28835==    by 0x57ED5F5: wcsrtombs (in /usr/lib/libc-2.26.so)
>> ==28835==    by 0x5782C41: wcstombs (in /usr/lib/libc-2.26.so)
>> ==28835==    by 0x11461B: make_aligned_titles (package.c:143)
>> ==28835==    by 0x11461B: dump_pkg_full (package.c:206)
>> ==28835==    by 0x11B90E: sync_info (sync.c:415)
>> ==28835==    by 0x11B90E: pacman_sync (sync.c:922)
>> ==28835==    by 0x115F29: main (pacman.c:1290)
>> ==28835==
>>
>> Signed-off-by: Allan McRae <al...@archlinux.org>
>> ---
>>
>> I think a supression is the way to go here...  It does not look like we do 
>> anything wrong.
> 
> We don't appear to initialized wbuf[i] anywhere.
> 

Ah...

This appears enough:

--- a/src/pacman/package.c
+++ b/src/pacman/package.c
@@ -92,7 +92,7 @@ static void make_aligned_titles(void)
        size_t maxlen = 0;
        int maxcol = 0;
        static const wchar_t title_suffix[] = L" :";
-       wchar_t wbuf[ARRAYSIZE(titles)][TITLE_MAXLEN +
ARRAYSIZE(title_suffix)];
+       wchar_t wbuf[ARRAYSIZE(titles)][TITLE_MAXLEN +
ARRAYSIZE(title_suffix)] = {{ 0 }};
        size_t wlen[ARRAYSIZE(wbuf)];
        int wcol[ARRAYSIZE(wbuf)];
        char *buf[ARRAYSIZE(wbuf)];

Reply via email to