[gnc-backend-dbi.cpp] if returning early, don't allocate char*

this function may return early causing leak from allocating
g_build_filename.
This commit is contained in:
Christopher Lam 2023-07-02 21:38:23 +08:00
parent 9ee3dd9595
commit b011c81b62

View File

@ -1094,12 +1094,14 @@ gnc_module_init_backend_dbi (void)
#endif
if (num_drivers <= 0)
{
#if HAVE_LIBDBI_R
if (dbi_instance)
return;
#endif
gchar *libdir = gnc_path_get_libdir ();
gchar *dir = g_build_filename (libdir, "dbd", nullptr);
g_free (libdir);
#if HAVE_LIBDBI_R
if (dbi_instance)
return;
num_drivers = dbi_initialize_r (dir, &dbi_instance);
#else
num_drivers = dbi_initialize (dir);