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 <maks.mishi...@gmail.com>
---
 cmd/nvedit.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/cmd/nvedit.c b/cmd/nvedit.c
index 1f25980129..628f0a2935 100644
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -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;
 
-- 
2.34.1

Reply via email to