Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

[cppcheck] found possible usage of unintialized variable #12

Open
orbitcowboy opened this Issue · 0 comments

1 participant

@orbitcowboy

cppcheck warned about a possible uninitialized variable if the preprocessor defines linux and FreeBSD are NOT set.

Please consider the following code from src/pcm.cc (staring form line 178) :

int e, end=0 ;
#if defined (linux)
e = readlink ("/proc/self/exe", link, sizeof(link)-1) ;
#elif defined (FreeBSD)
int exe_path_mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, getpid() } ;
size_t exe_path_size = sizeof (link) ;
e = sysctl (exe_path_mib, 4, link, &exe_path_size, NULL, 0) ;

    if (e != -1)
        e = strlen (link) ;

#endif
if (e == -1) // <--- possible usage of uninitialized value of e
{....

Best regards from the cppcheck team

Martin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.