int main()
{
pid_t current_pid;
char cmd_str[50];
pid_t pid = fork();
current_pid = getpid();
sprintf(cmd_str, "%s %d %s\n", "leaks", current_pid, ">> leaks.txt 2>&1");
system(cmd_str);
}
==================================================
Process: a.out [42772]
Path: /Users/*/a.out
Load Address: 0x104708000
Identifier: a.out
Version: ???
Code Type: X86-64
Parent Process: zsh [38325]
Date/Time: 2021-09-07 14:14:35.426 +0900
Launch Time: 2021-09-07 14:14:35.184 +0900
OS Version: Mac OS X 10.14.6 (18G9216)
Report Version: 7
Analysis Tool: /Applications/Xcode.app/Contents/Developer/usr/bin/leaks
Analysis Tool Version: Xcode 11.3.1 (11C505)
----
leaks Report Version: 4.0
Process 42772: 146 nodes malloced for 13 KB
Process 42772: 0 leaks for 0 total leaked bytes.
Process: a.out [42773]
Path: /Users/*/a.out
Load Address: 0x104708000
Identifier: a.out
Version: ???
Code Type: X86-64
Parent Process: a.out [42772]
Date/Time: 2021-09-07 14:14:35.426 +0900
Launch Time: 2021-09-07 14:14:35.187 +0900
OS Version: Mac OS X 10.14.6 (18G9216)
Report Version: 7
Analysis Tool: /Applications/Xcode.app/Contents/Developer/usr/bin/leaks
Analysis Tool Version: Xcode 11.3.1 (11C505)
----
leaks Report Version: 4.0
Process 42773: 161 nodes malloced for 22 KB
Process 42773: 4 leaks for 4128 total leaked bytes.
4 (4.03K) << TOTAL >>
2 (2.02K) ROOT LEAK: 0x7febfb500040 [16]
1 (2.00K) 0x7febfc000800 [2048]
2 (2.02K) ROOT LEAK: 0x7febfb500050 [16]
1 (2.00K) 0x7febfc001000 [2048]
==================================================
mainの中で明示的にメモリを確保していないのに、メモリリークするのがどうしてかわかりません。
どなたかご教示いただけると助かります。