intel / libva

Libva is an implementation for VA-API (Video Acceleration API)

Home Page:http://intel.github.io/libva/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cppcheck intel/libva@8575b2b

denji opened this issue · comments

cd libva-8575b2bbc6d5cbf31690e682f4fa268d742fcb62
meson ./build/ -Dwith_x11=yes \
  -Dwith_legacy=emdg,nvctrl,fglrx -Dwith_win32=no \
  -Dwith_glx=yes \
  -Dprefix=/usr -Dlibdir=/usr/lib64
ninja -Cbuild
ninja -C./build/ -t compdb > compile_commands.json
cppcheck --platform=unix64 --std=c98 --project=compile_commands.json \
                  -f --enable=warning,performance,portability -j4 . 2> err_c98.txt
$ cat err_c98.txt
va/glx/va_glx_impl.c:171:5: portability: Returning an integer in a function with pointer return type is not portable. [CastIntegerToAddressAtReturn]
    return get_proc_func(name);
    ^
va/va_trace.c:557:9: warning: %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint]
        sprintf(env_value + tmp,
        ^
va/va_trace.c:557:9: warning: %d in format string (no. 2) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint]
        sprintf(env_value + tmp,
        ^
va/va_trace.c:557:9: warning: %d in format string (no. 3) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint]
        sprintf(env_value + tmp,
        ^
va/va_trace.c:1638:45: warning: Either the condition 'buf_id' is redundant or there is possible null pointer dereference: buf_id. [nullPointerRedundantCheck]
    add_trace_buf_info(pva_trace, context, *buf_id);
                                            ^
va/va_trace.c:1646:9: note: Assuming that condition 'buf_id' is not redundant
    if (buf_id)
        ^
va/va_trace.c:1638:45: note: Null pointer dereference
    add_trace_buf_info(pva_trace, context, *buf_id);
                                            ^
va/win32/va_win32.c:207:5: error: Memory leak: pDriverContext.native_dpy [memleak]
    return (VADisplay)pDisplayContext;
    ^

the issue resolved?
I follow the steps, but there are no c98, so I select c99. there is some error:
[va/win32/va_win32.c:207]: (error) Memory leak: pDriverContext.native_dpy
[va/va_trace.c:557]: (warning) %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'.
[va/va_trace.c:557]: (warning) %d in format string (no. 2) requires 'int' but the argument type is 'unsigned int'.
[va/va_trace.c:557]: (warning) %d in format string (no. 3) requires 'int' but the argument type is 'unsigned int'.
[va/va_trace.c:1671] -> [va/va_trace.c:1663]: (warning) Either the condition 'if(buf_id)' is redundant or there is possible null pointer dereference: buf_id.
[va/compat_win32.h:203]: (error) syntax error

It's not solved, here's a more detailed log #755