mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2025-02-20 11:43:27 +08:00
Fastfetch: fix memory leaks when passing informative options
Informative options (e.g. "--help", "--list-module") make fastfetch exit before calling ffDestroyInstance. Using "atexit" to avoid this kind of leak.
This commit is contained in:
parent
366138e1bd
commit
16b875ef5a
@ -863,6 +863,7 @@ static void writeConfigFile(FFdata* data, const FFstrbuf* filename)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
ffInitInstance();
|
||||
atexit(ffDestroyInstance);
|
||||
|
||||
//Data stores things only needed for the configuration of fastfetch
|
||||
FFdata data = {
|
||||
@ -888,6 +889,4 @@ int main(int argc, char** argv)
|
||||
ffStrbufDestroy(&customValue->value);
|
||||
}
|
||||
ffListDestroy(&data.customValues);
|
||||
|
||||
ffDestroyInstance();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user