//
// DSO_free from 0xd8a804 to 0xd8a954 (336 bytes)
//
// 12 xrefs:
// > CONF_modules_load @ 0xd820b0
// > CONF_modules_unload @ 0xd82468
// > CONF_modules_unload @ 0xd824d8
// > DSO_new @ 0xd8a9f4
// > DSO_load @ 0xd8af34
// > DSO_load @ 0xd8afb4
// > sub_E5D020 @ 0xe5d040
// > sub_E5D098 @ 0xe5d3d0
// > sub_E5D098 @ 0xe5d6e4
// > sub_E5D098 @ 0xe5d728
// > sub_E5D098 @ 0xe5d7e8
// > ??> @ 0xb80c8
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
__int64 __fastcall DSO_free(__int64 *a1)
{
unsigned int v2; // w20
__int64 v4; // x0
__int64 (__fastcall *v5)(__int64 *); // x1
__int64 (__fastcall *v6)(__int64 *); // x1
int v7; // [xsp+3Ch] [xbp+3Ch] BYREF
if ( !a1 )
return 1;
if ( (int)CRYPTO_atomic_add(a1 + 2, 0xFFFFFFFFLL, &v7, a1[8]) <= 0 )
return 0;
if ( v7 > 0 )
return 1;
if ( (*((_DWORD *)a1 + 5) & 4) != 0 )
goto LABEL_7;
v4 = *a1;
v6 = *(__int64 (__fastcall **)(__int64 *))(*a1 + 16);
if ( v6 )
{
v2 = v6(a1);
if ( !v2 )
{
ERR_put_error(37, 111, 107, "crypto/dso/dso_lib.c", 78);
return v2;
}
LABEL_7:
v4 = *a1;
}
v5 = *(__int64 (__fastcall **)(__int64 *))(v4 + 64);
if ( v5 )
{
v2 = v5(a1);
if ( !v2 )
{
ERR_put_error(37, 111, 102, "crypto/dso/dso_lib.c", 84);
return v2;
}
}
OPENSSL_sk_free(a1[1]);
CRYPTO_free(a1[6], "crypto/dso/dso_lib.c", 89);
CRYPTO_free(a1[7], "crypto/dso/dso_lib.c", 90);
CRYPTO_THREAD_lock_free(a1[8]);
CRYPTO_free(a1, "crypto/dso/dso_lib.c", 92);
return 1;
}