[PATCH 22/23] sandbox: os: add_image: fix memory leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



devname is strdup'd few lines later, so remove the earlier strdup.
The pointer isn't stored anywhere persistent in between.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 arch/sandbox/os/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sandbox/os/common.c b/arch/sandbox/os/common.c
index e67ea14138c0..382a92304020 100644
--- a/arch/sandbox/os/common.c
+++ b/arch/sandbox/os/common.c
@@ -236,7 +236,7 @@ static int add_image(char *str, char *devname_template, int *devname_number)
 		filename = devname;
 		snprintf(tmp, sizeof(tmp),
 			 devname_template, (*devname_number)++);
-		devname = strdup(tmp);
+		devname = tmp;
 	}
 
 	printf("add %s backed by file %s%s\n", devname,
-- 
2.26.2


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux