From d6183a95b334c98582338f5ec09877caab8990fa Mon Sep 17 00:00:00 2001 From: SanthoshGujulvajagadeesh <68006718+SanthoshGujulvajagadeesh@users.noreply.github.com> Date: Wed, 4 Feb 2026 06:22:34 +0000 Subject: [PATCH] leaky function --- source/MoCASsp/ssp_main.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/source/MoCASsp/ssp_main.c b/source/MoCASsp/ssp_main.c index 31e4456..a3079ff 100644 --- a/source/MoCASsp/ssp_main.c +++ b/source/MoCASsp/ssp_main.c @@ -234,6 +234,16 @@ int drop_root(void) return retval; } +void leaky_function(void) { + char *p = (char *)malloc(100); // allocated but never freed -> leak + if (!p) { + perror("malloc"); + return; + } + strcpy(p, "This buffer is intentionally leaked."); + // Missing free(p); <-- leak +} + int main(int argc, char* argv[]) { BOOL bRunAsDaemon = TRUE; @@ -247,6 +257,8 @@ int main(int argc, char* argv[]) DmErr_t err; debugLogFile = stderr; + leaky_function(); + #ifdef FEATURE_SUPPORT_RDKLOG RDK_LOGGER_INIT(); #endif