maketable: clean up resources
Subsystems (2)
PATCH 1/1 maketable: clean up resources
Signed-off-by gaoxingwang <[email protected]>
--- netem/maketable.c | 3 +++ 1 file changed, 3 insertions(+)
netem/maketable.c +3 -0
@@ -230,5 +230,8 @@ main(int argc, char **argv) inverse =inverttable (table,TABLESIZE ,DISTTABLESIZE , total);interpolatetable (inverse,TABLESIZE );printtable (inverse,TABLESIZE ); +free (table); +free (inverse) +close (fp);return 0 ; }
Signature · 1 line
2.27.0
Quoted 10 lines · On Wed, 12 Oct 2022 17:35:34 +0800 gaoxingwang <[email protected]> wrote:
Signed-off-by gaoxingwang <[email protected]>--- netem/maketable.c | 3 +++ 1 file changed, 3 insertions(+)netem/maketable.c +0
-0
netem/maketable.c main(int argc, char **argv) · line 237
Quoted 8 lines
netem/maketable.c +3
-0@@ -230,5 +230,8 @@ main(int argc, char **argv) inverse =inverttable (table,TABLESIZE ,DISTTABLESIZE , total);interpolatetable (inverse,TABLESIZE );printtable (inverse,TABLESIZE ); +free (table); +free (inverse) +close (fp);return 0 ; }
Why bother. This is a tool only used during builds and this the end of the main program so all resources will disappear after return.
On Mon, 17 Oct 2022 20:29:14 -0700 [thread overview]
Quoted 8 lines
Quoted 5 lines · On Wed, 12 Oct 2022 17:35:34 +0800 gaoxingwang <[email protected]> wrote:
Signed-off-by gaoxingwang <[email protected]>--- netem/maketable.c | 3 +++ 1 file changed, 3 insertions(+)
Quoted 16 lines
netem/maketable.c main(int argc, char **argv) · line 237
Quoted 13 lines
netem/maketable.c +3
-0@@ -230,5 +230,8 @@ main(int argc, char **argv) inverse =inverttable (table,TABLESIZE ,DISTTABLESIZE , total);interpolatetable (inverse,TABLESIZE );printtable (inverse,TABLESIZE ); +free (table); +free (inverse) +close (fp);return 0 ; }Why bother. This is a tool only used during builds and this the end of the main program so all resources will disappear after return.
I found this issue because a white box scan of the code. Maybe fixing this will save us from the effort to explain it.