diff --git a/cpp/ql/lib/semmle/code/cpp/models/implementations/Allocation.qll b/cpp/ql/lib/semmle/code/cpp/models/implementations/Allocation.qll index 305a0c25732..4b61a193652 100644 --- a/cpp/ql/lib/semmle/code/cpp/models/implementations/Allocation.qll +++ b/cpp/ql/lib/semmle/code/cpp/models/implementations/Allocation.qll @@ -36,7 +36,9 @@ private class MallocAllocationFunction extends AllocationFunction { "CRYPTO_malloc", // CRYPTO_malloc(size_t num, const char *file, int line) "CRYPTO_zalloc", // CRYPTO_zalloc(size_t num, const char *file, int line) "CRYPTO_secure_malloc", // CRYPTO_secure_malloc(size_t num, const char *file, int line) - "CRYPTO_secure_zalloc" // CRYPTO_secure_zalloc(size_t num, const char *file, int line) + "CRYPTO_secure_zalloc", // CRYPTO_secure_zalloc(size_t num, const char *file, int line) + "g_malloc", // g_malloc (n_bytes); + "g_try_malloc" // g_try_malloc(n_bytes); ]) and sizeArg = 0 or @@ -139,7 +141,9 @@ private class ReallocAllocationFunction extends AllocationFunction, TaintFunctio // --- Windows COM allocation "CoTaskMemRealloc", // CoTaskMemRealloc(ptr, size) // --- OpenSSL memory allocation - "CRYPTO_realloc" // CRYPTO_realloc(void *addr, size_t num, const char *file, int line) + "CRYPTO_realloc", // CRYPTO_realloc(void *addr, size_t num, const char *file, int line) + "g_realloc", // g_realloc(mem, n_bytes); + "g_try_realloc" // g_try_realloc(mem, n_bytes); ]) and sizeArg = 1 and reallocArg = 0 diff --git a/cpp/ql/lib/semmle/code/cpp/models/implementations/Deallocation.qll b/cpp/ql/lib/semmle/code/cpp/models/implementations/Deallocation.qll index 1162c09b0b6..e50530142aa 100644 --- a/cpp/ql/lib/semmle/code/cpp/models/implementations/Deallocation.qll +++ b/cpp/ql/lib/semmle/code/cpp/models/implementations/Deallocation.qll @@ -20,8 +20,10 @@ private class StandardDeallocationFunction extends DeallocationFunction { freedArg = 0 or this.hasGlobalName([ - // --- OpenSSL memory allocation - "CRYPTO_free", "CRYPTO_secure_free" + // --- OpenSSL memory deallocation + "CRYPTO_free", "CRYPTO_secure_free", + // --- glib memory deallocation + "g_free" ]) and freedArg = 0 or