mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02: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:
+1
-2
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user