cmd: Fix potential memory leaks
PATCH 1/1 cmd: Fix potential memory leaks
Dynamic memories, referenced by 'ptr' and 'res' is allocated
by calling function 'hexport_r' and lost when the function success returns.
Signed-off-by Maks Mishin <[email protected]>
--- cmd/nvedit.c | 2 ++ 1 file changed, 2 insertions(+)
cmd/nvedit.c +2 -0
@@ -698,6 +698,7 @@ NXTARG: ; }sprintf (buf,"%zX" , (size_t )len);env_set ("filesize" , buf); +free (ptr);return 0 ; }
@@ -726,6 +727,7 @@ NXTARG: ;#endif }env_set_hex ("filesize" , len + offsetof(env_t , data)); +free (res);return 0 ;
Signature · 1 line
2.34.1
Quoted 4 lines · Maks Mishin
Dynamic memories, referenced by 'ptr' and 'res' is allocated
by calling function 'hexport_r' and lost when the function success returns.Signed-off-by Maks Mishin <[email protected]>
This leads to run time failures such as:
https://source.denx.de/u-boot/u-boot/-/jobs/1018913
Signature · 1 line
Tom