From 1a12d5852602a7507d5911408561a754c446539c Mon Sep 17 00:00:00 2001 From: Benny Baumann Date: Mon, 8 Apr 2024 10:48:24 +0200 Subject: Work around GCC14 memleak diagnostic While both pointers are identical, GCC-14 with -fanalyzer complains about these return statements to leak memory. The leak is only reported with LTO though. --- darwin/DarwinProcess.c | 2 +- dragonflybsd/DragonFlyBSDProcess.c | 2 +- freebsd/FreeBSDProcess.c | 2 +- linux/LinuxProcess.c | 2 +- netbsd/NetBSDProcess.c | 2 +- openbsd/OpenBSDProcess.c | 2 +- pcp/PCPProcess.c | 2 +- solaris/SolarisProcess.c | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/darwin/DarwinProcess.c b/darwin/DarwinProcess.c index 29563a64..1da4221c 100644 --- a/darwin/DarwinProcess.c +++ b/darwin/DarwinProcess.c @@ -62,7 +62,7 @@ Process* DarwinProcess_new(const Machine* host) { this->taskAccess = true; this->translated = false; - return &this->super; + return (Process*)this; } void Process_delete(Object* cast) { diff --git a/dragonflybsd/DragonFlyBSDProcess.c b/dragonflybsd/DragonFlyBSDProcess.c index 915ecd09..002378a7 100644 --- a/dragonflybsd/DragonFlyBSDProcess.c +++ b/dragonflybsd/DragonFlyBSDProcess.c @@ -56,7 +56,7 @@ Process* DragonFlyBSDProcess_new(const Machine* host) { DragonFlyBSDProcess* this = xCalloc(1, sizeof(DragonFlyBSDProcess)); Object_setClass(this, Class(DragonFlyBSDProcess)); Process_init(&this->super, host); - return &this->super; + return (Process*)this; } void Process_delete(Object* cast) { diff --git a/freebsd/FreeBSDProcess.c b/freebsd/FreeBSDProcess.c index 901f9dad..662943c9 100644 --- a/freebsd/FreeBSDProcess.c +++ b/freebsd/FreeBSDProcess.c @@ -62,7 +62,7 @@ Process* FreeBSDProcess_new(const Machine* machine) { FreeBSDProcess* this = xCalloc(1, sizeof(FreeBSDProcess)); Object_setClass(this, Class(FreeBSDProcess)); Process_init(&this->super, machine); - return &this->super; + return (Process*)this; } void Process_delete(Object* cast) { diff --git a/linux/LinuxProcess.c b/linux/LinuxProcess.c index f809cc60..741fe19d 100644 --- a/linux/LinuxProcess.c +++ b/linux/LinuxProcess.c @@ -118,7 +118,7 @@ Process* LinuxProcess_new(const Machine* host) { LinuxProcess* this = xCalloc(1, sizeof(LinuxProcess)); Object_setClass(this, Class(LinuxProcess)); Process_init(&this->super, host); - return &this->super; + return (Process*)this; } void Process_delete(Object* cast) { diff --git a/netbsd/NetBSDProcess.c b/netbsd/NetBSDProcess.c index 3af5a872..5462e721 100644 --- a/netbsd/NetBSDProcess.c +++ b/netbsd/NetBSDProcess.c @@ -219,7 +219,7 @@ Process* NetBSDProcess_new(const Machine* host) { NetBSDProcess* this = xCalloc(1, sizeof(NetBSDProcess)); Object_setClass(this, Class(NetBSDProcess)); Process_init(&this->super, host); - return &this->super; + return (Process*)this; } void Process_delete(Object* cast) { diff --git a/openbsd/OpenBSDProcess.c b/openbsd/OpenBSDProcess.c index 4ac7aef1..7f50b0f8 100644 --- a/openbsd/OpenBSDProcess.c +++ b/openbsd/OpenBSDProcess.c @@ -211,7 +211,7 @@ Process* OpenBSDProcess_new(const Machine* host) { OpenBSDProcess* this = xCalloc(1, sizeof(OpenBSDProcess)); Object_setClass(this, Class(OpenBSDProcess)); Process_init(&this->super, host); - return &this->super; + return (Process*)this; } void Process_delete(Object* cast) { diff --git a/pcp/PCPProcess.c b/pcp/PCPProcess.c index 27630fc5..e8cc1aad 100644 --- a/pcp/PCPProcess.c +++ b/pcp/PCPProcess.c @@ -97,7 +97,7 @@ Process* PCPProcess_new(const Machine* host) { PCPProcess* this = xCalloc(1, sizeof(PCPProcess)); Object_setClass(this, Class(PCPProcess)); Process_init(&this->super, host); - return &this->super; + return (Process*)this; } void Process_delete(Object* cast) { diff --git a/solaris/SolarisProcess.c b/solaris/SolarisProcess.c index 2dd03f0f..29e981df 100644 --- a/solaris/SolarisProcess.c +++ b/solaris/SolarisProcess.c @@ -64,7 +64,7 @@ Process* SolarisProcess_new(const Machine* host) { SolarisProcess* this = xCalloc(1, sizeof(SolarisProcess)); Object_setClass(this, Class(SolarisProcess)); Process_init(&this->super, host); - return &this->super; + return (Process*)this; } void Process_delete(Object* cast) { -- cgit v1.2.3