Skip to content

Commit

Permalink
Work around GCC14 memleak diagnostic
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
BenBE committed Apr 8, 2024
1 parent 327593e commit 1a12d58
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion darwin/DarwinProcess.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion dragonflybsd/DragonFlyBSDProcess.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion freebsd/FreeBSDProcess.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion linux/LinuxProcess.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion netbsd/NetBSDProcess.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion openbsd/OpenBSDProcess.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion pcp/PCPProcess.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion solaris/SolarisProcess.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 1a12d58

Please sign in to comment.