gem5-dev@gem5.org

The gem5 Developer List

View all threads

[XS] Change in gem5/gem5[develop]: util: Add a missing free() to m5term.

GB
Gabe Black (Gerrit)
Sat, Apr 8, 2023 12:07 PM

Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/69557?usp=email )

Change subject: util: Add a missing free() to m5term.
......................................................................

util: Add a missing free() to m5term.

The "cwd" string is used to store the previous working directory, if
m5term needs to change it to maximize the space it has to create a
unix domain socket using a relative path. That string was not being
freed, which is a small memory leak. This change frees that memory.

Change-Id: I1ad901e7c59614dd938165cae91c3f666d86e872

M util/term/term.c
1 file changed, 1 insertion(+), 0 deletions(-)

diff --git a/util/term/term.c b/util/term/term.c
index cf3fdda..b1624b2 100644
--- a/util/term/term.c
+++ b/util/term/term.c
@@ -235,6 +235,7 @@
perror("chdir back failed:");
exit(1);
}

  •    free(cwd);
    }
    
    // Return the FD of our new connection.
    

--
To view, visit
https://gem5-review.googlesource.com/c/public/gem5/+/69557?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I1ad901e7c59614dd938165cae91c3f666d86e872
Gerrit-Change-Number: 69557
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black gabe.black@gmail.com
Gerrit-CC: Gabe Black gabeblack@google.com
Gerrit-MessageType: newchange

Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/69557?usp=email ) Change subject: util: Add a missing free() to m5term. ...................................................................... util: Add a missing free() to m5term. The "cwd" string is used to store the previous working directory, if m5term needs to change it to maximize the space it has to create a unix domain socket using a relative path. That string was not being freed, which is a small memory leak. This change frees that memory. Change-Id: I1ad901e7c59614dd938165cae91c3f666d86e872 --- M util/term/term.c 1 file changed, 1 insertion(+), 0 deletions(-) diff --git a/util/term/term.c b/util/term/term.c index cf3fdda..b1624b2 100644 --- a/util/term/term.c +++ b/util/term/term.c @@ -235,6 +235,7 @@ perror("chdir back failed:"); exit(1); } + free(cwd); } // Return the FD of our new connection. -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/69557?usp=email To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings Gerrit-Project: public/gem5 Gerrit-Branch: develop Gerrit-Change-Id: I1ad901e7c59614dd938165cae91c3f666d86e872 Gerrit-Change-Number: 69557 Gerrit-PatchSet: 1 Gerrit-Owner: Gabe Black <gabe.black@gmail.com> Gerrit-CC: Gabe Black <gabeblack@google.com> Gerrit-MessageType: newchange