mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
Leak sanitizer: no false positives
This commit is contained in:
@@ -15,4 +15,5 @@ else
|
||||
fi
|
||||
cmake --build . --target fastfetch ${cmake_build_extra_args}
|
||||
|
||||
export LSAN_OPTIONS=suppressions=../tests/lsan.supp
|
||||
./fastfetch "$@"
|
||||
|
||||
+7
-2
@@ -132,7 +132,7 @@ static void initModuleArg(FFModuleArgs* args)
|
||||
|
||||
static void defaultConfig(FFinstance* instance)
|
||||
{
|
||||
ffStrbufInit(&instance->config.logo.source);
|
||||
ffStrbufInitA(&instance->config.logo.source, 0);
|
||||
instance->config.logo.type = FF_LOGO_TYPE_AUTO;
|
||||
for(uint8_t i = 0; i < (uint8_t) FASTFETCH_LOGO_MAX_COLORS; ++i)
|
||||
ffStrbufInit(&instance->config.logo.colors[i]);
|
||||
@@ -383,17 +383,22 @@ void ffFinish(FFinstance* instance)
|
||||
ffLogoPrintRemaining(instance);
|
||||
|
||||
resetConsole();
|
||||
}
|
||||
|
||||
void ffDestroyInstance(FFinstance* instance)
|
||||
{
|
||||
for(uint32_t i = 0; i < instance->state.configDirs.length; ++i)
|
||||
ffStrbufDestroy((FFstrbuf*)ffListGet(&instance->state.configDirs, i));
|
||||
ffListDestroy(&instance->state.configDirs);
|
||||
|
||||
ffStrbufDestroy(&instance->state.cacheDir);
|
||||
|
||||
for(uint8_t i = 0; i < (uint8_t) FASTFETCH_LOGO_MAX_COLORS; ++i)
|
||||
ffStrbufDestroy(&instance->config.logo.colors[i]);
|
||||
|
||||
ffStrbufDestroy(&instance->config.colorKeys);
|
||||
ffStrbufDestroy(&instance->config.colorTitle);
|
||||
ffStrbufDestroy(&instance->config.separator);
|
||||
ffStrbufDestroy(&instance->config.logo.source);
|
||||
}
|
||||
|
||||
//Must be in a file compiled with the libfastfetch target, because the FF_HAVE* macros are not defined for the executable targets
|
||||
|
||||
+16
-3
@@ -3,9 +3,22 @@
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
//Clang doesn't define __SANITIZE_ADDRESS__ but defines __has_feature(address_sanitizer)
|
||||
#if defined(__has_feature)
|
||||
#if __has_feature(address_sanitizer)
|
||||
#define __SANITIZE_ADDRESS__
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __SANITIZE_ADDRESS__
|
||||
#define FF_DLOPEN_FLAGS RTLD_LAZY | RTLD_NODELETE
|
||||
#else
|
||||
#define FF_DLOPEN_FLAGS RTLD_LAZY
|
||||
#endif
|
||||
|
||||
static void* libraryLoad(const char* path, int maxVersion)
|
||||
{
|
||||
void* result = dlopen(path, RTLD_LAZY);
|
||||
void* result = dlopen(path, FF_DLOPEN_FLAGS);
|
||||
if(result != NULL || maxVersion < 0)
|
||||
return result;
|
||||
|
||||
@@ -19,7 +32,7 @@ static void* libraryLoad(const char* path, int maxVersion)
|
||||
uint32_t originalLength = pathbuf.length;
|
||||
ffStrbufAppendF(&pathbuf, "%i", i);
|
||||
|
||||
result = dlopen(pathbuf.chars, RTLD_LAZY);
|
||||
result = dlopen(pathbuf.chars, FF_DLOPEN_FLAGS);
|
||||
if(result != NULL)
|
||||
break;
|
||||
|
||||
@@ -33,7 +46,7 @@ static void* libraryLoad(const char* path, int maxVersion)
|
||||
void* ffLibraryLoad(const FFstrbuf* userProvidedName, ...)
|
||||
{
|
||||
if(userProvidedName != NULL && userProvidedName->length > 0)
|
||||
return dlopen(userProvidedName->chars, RTLD_LAZY);
|
||||
return dlopen(userProvidedName->chars, FF_DLOPEN_FLAGS);
|
||||
|
||||
va_list defaultNames;
|
||||
va_start(defaultNames, userProvidedName);
|
||||
|
||||
+4
-1
@@ -1448,8 +1448,11 @@ int main(int argc, const char** argv)
|
||||
|
||||
startIndex = colonIndex + 1;
|
||||
}
|
||||
|
||||
ffFinish(&instance);
|
||||
|
||||
ffStrbufDestroy(&data.structure);
|
||||
ffValuestoreDestroy(&data.customValues);
|
||||
|
||||
ffFinish(&instance);
|
||||
ffDestroyInstance(&instance);
|
||||
}
|
||||
|
||||
@@ -201,6 +201,7 @@ typedef struct FFinstance
|
||||
void ffInitInstance(FFinstance* instance);
|
||||
void ffStart(FFinstance* instance);
|
||||
void ffFinish(FFinstance* instance);
|
||||
void ffDestroyInstance(FFinstance* instance);
|
||||
|
||||
void ffListFeatures();
|
||||
|
||||
|
||||
@@ -93,6 +93,8 @@ void ffPrintSong(FFinstance* instance)
|
||||
ffStrbufAppendF(&songPretty, " (%s)", media->status.chars);
|
||||
|
||||
ffStrbufPutTo(&songPretty, stdout);
|
||||
|
||||
ffStrbufDestroy(&artistPretty);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
leak:*libwayland-client.so*
|
||||
Reference in New Issue
Block a user