procdump 2.2-1 fails to build from source on Ubuntu. I can reproduce it locally.
``` src/Monitor.c: In function 'WaitForProfilerCompletion': src/Monitor.c:1602:5: error: leak of file descriptor 'socket(1, 1, 0)' [CWE-775] [-Werror=analyzer-fd-leak] 1602 | pthread_mutex_lock(&config->dotnetMutex); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'WaitForProfilerCompletion': events 1-3 | | 1545 | if((s = socket(AF_UNIX, SOCK_STREAM, 0))==-1) | | ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | | | (1) stream socket created here | | | (2) when 'socket' succeeds | | (3) following 'false' branch... | 'WaitForProfilerCompletion': events 4-16 | | 1553 | local.sun_family = AF_UNIX; | | ^ | | | | | (4) ...to here |...... | 1557 | if(bind(s, (struct sockaddr *)&local, len)==-1) | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | || | | |(5) stream socket bound here | | |(6) when 'bind' succeeds | | (7) following 'false' branch... |...... | 1569 | chmod(tmpFolder, 0777); | | ~~~~~~~~~~~~~~~~~~~~~~ | | | | | (8) ...to here |...... | 1577 | if ((pthread_create(&processMonitor, NULL, ProcessMonitor, (void *) config)) != 0) | | ~ | | | | | (9) following 'false' branch... |...... | 1590 | if(listen(s, MAX_PROFILER_CONNECTIONS)==-1) | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | || | | |(10) ...to here | | |(11) stream socket marked as passive here via 'listen' | | |(12) when 'listen' succeeds | | (13) following 'false' branch... |...... | 1602 | pthread_mutex_lock(&config->dotnetMutex); | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (14) ...to here |...... | 1612 | if((s2 = accept(s, (struct sockaddr *)&remote, &t))==-1) | | ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | | | (15) when 'accept' fails | | (16) following 'true' branch... | 'WaitForProfilerCompletion': event 17 | |./include/Logging.h:51:5: | 51 | DiagTrace(format " %s", ##__VA_ARGS__, LOCATION); | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (17) ...to here src/Monitor.c:1615:13: note: in expansion of macro 'Trace' | 1615 | Trace("WaitForProfilerCompletion: Failed in accept call on socket\n"); | | ^~~~~ | 'WaitForProfilerCompletion': event 18 | | 1602 | pthread_mutex_lock(&config->dotnetMutex); | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (18) 'socket(1, 1, 0)' leaks here | cc1: all warnings being treated as errors ```
procdump 2.2-1 fails to build from source on Ubuntu. I can reproduce it locally.
``` rCompletion' : c:1602: 5: error: leak of file descriptor 'socket(1, 1, 0)' [CWE-775] [-Werror= analyzer- fd-leak] mutex_lock( &config- >dotnetMutex) ; ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~ lerCompletion' : events 1-3 ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~ lerCompletion' : events 4-16 ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~ ~~~~~~~ ~~~~~~~ ~ create( &processMonitor , NULL, ProcessMonitor, (void *) config)) != 0) CONNECTIONS) ==-1) ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ~ mutex_lock( &config- >dotnetMutex) ; ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~ lerCompletion' : event 17 include/ Logging. h:51:5: ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~ c:1615: 13: note: in expansion of macro 'Trace' WaitForProfiler Completion: Failed in accept call on socket\n"); lerCompletion' : event 18 mutex_lock( &config- >dotnetMutex) ; ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~
src/Monitor.c: In function 'WaitForProfile
src/Monitor.
1602 | pthread_
| ^~~~~~~
'WaitForProfi
|
| 1545 | if((s = socket(AF_UNIX, SOCK_STREAM, 0))==-1)
| | ~ ^~~~~~~
| | | |
| | | (1) stream socket created here
| | | (2) when 'socket' succeeds
| | (3) following 'false' branch...
|
'WaitForProfi
|
| 1553 | local.sun_family = AF_UNIX;
| | ^
| | |
| | (4) ...to here
|......
| 1557 | if(bind(s, (struct sockaddr *)&local, len)==-1)
| | ~~~~~~~
| | ||
| | |(5) stream socket bound here
| | |(6) when 'bind' succeeds
| | (7) following 'false' branch...
|......
| 1569 | chmod(tmpFolder, 0777);
| | ~~~~~~~
| | |
| | (8) ...to here
|......
| 1577 | if ((pthread_
| | ~
| | |
| | (9) following 'false' branch...
|......
| 1590 | if(listen(s, MAX_PROFILER_
| | ~~~~~~~
| | ||
| | |(10) ...to here
| | |(11) stream socket marked as passive here via 'listen'
| | |(12) when 'listen' succeeds
| | (13) following 'false' branch...
|......
| 1602 | pthread_
| | ~~~~~~~
| | |
| | (14) ...to here
|......
| 1612 | if((s2 = accept(s, (struct sockaddr *)&remote, &t))==-1)
| | ~ ~~~~~~~
| | | |
| | | (15) when 'accept' fails
| | (16) following 'true' branch...
|
'WaitForProfi
|
|./
| 51 | DiagTrace(format " %s", ##__VA_ARGS__, LOCATION);
| | ^~~~~~~
| | |
| | (17) ...to here
src/Monitor.
| 1615 | Trace("
| | ^~~~~
|
'WaitForProfi
|
| 1602 | pthread_
| | ^~~~~~~
| | |
| | (18) 'socket(1, 1, 0)' leaks here
|
cc1: all warnings being treated as errors
```