TLSRPT_SET_MALLOC_AND_FREE(3)
π TLSRPT_SET_MALLOC_AND_FREE π
okay bestie, so this page is tlsrpt_set_malloc_and_free from section 3 of the manual (that's the C library functions girlies π), and it's lowkey one of those tiny functions that does one very specific thing and does it slay. let's get into it β¨
β¨ NAME β¨
tlsrpt_set_malloc_and_free β swaps out the malloc implementation that libtlsrpt uses inside itself π«Ά
πΈ SYNOPSIS πΈ
#include <tlsrpt.h>
void tlsrpt_set_malloc_and_free(void* (*malloc_function)(size_t size),
void (*free_function)(void *ptr))
yes she takes two function pointers and yes that signature is a whole vibe. copy it exactly, don't freestyle it π
π¦ DESCRIPTION π¦
so the way that tlsrpt_set_malloc_and_free works is: it replaces the malloc implementation used within libtlsrpt. within, okay? not everywhere. the replaced malloc gets used inside libtlsrpt for exactly two things β allocating the struct tlsrpt_connection_t and the struct tlsrpt_dr_t structures. that's it. that's the whole list. πβ¨
and literally none of the other malloc calls from inside the C standard library are affected. nope, not those. they stay doing their own thing π
β οΈ okay this is the important part, do not scroll past it β οΈ
this function must be called before any of the allocating functions β that meanstlsrpt_openandtlsrpt_init_delivery_requestβ get called! because if you don't, you end up with onemallocimplementation trying to free a pointer that a differentmallocimplementation allocated. and that is a whole mess, bestie. that's a π situation. it's giving chaos and not the fun kind.
π RETURN VALUE π
tlsrpt_set_malloc_and_free has no return value. nothing to check, nothing to unwrap, she's just void. periodt. π
π₯ SEE ALSO π₯
man:tlsrpt_open[3]man:tlsrpt_init_delivery_request[3]
go read those two, they're the ones that actually allocate stuff and the ones you need to call this function before, iykyk π
π AUTHOR π
Boris Lohner β thank you for your service king π«‘β¨
and that's the page!! this was tlsrpt_set_malloc_and_free, dated 2026-05-12, living in section TLSRPT_SET...C_AND_FREE(3) of the manual β go call it before you allocate anything or regret it forever ππ§β
π¦ where this page comes from
- ubuntu stonking: libtlsrpt0-dev 0.5.1~rc1-2 Β· LGPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms