[lxc-devel] [lxc/master] storage: Resource leak
2xsec on Github
lxc-bot at linuxcontainers.org
Fri Jun 15 02:12:40 UTC 2018
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 354 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180615/57bb259d/attachment.bin>
-------------- next part --------------
From 6666b28fbc5fede8b936c026d19f7c675d2ecfb7 Mon Sep 17 00:00:00 2001
From: Donghwa Jeong <dh48.jeong at samsung.com>
Date: Fri, 15 Jun 2018 11:11:48 +0900
Subject: [PATCH] storage: Resource leak
Signed-off-by: Donghwa Jeong <dh48.jeong at samsung.com>
---
src/lxc/storage/storage_utils.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/lxc/storage/storage_utils.c b/src/lxc/storage/storage_utils.c
index 6570bb88e..fa8dfaf41 100644
--- a/src/lxc/storage/storage_utils.c
+++ b/src/lxc/storage/storage_utils.c
@@ -93,8 +93,10 @@ char *dir_new_path(char *src, const char *oldname, const char *name,
/* copy text up to oldname */
retlen = strlcpy(p, src, p2 - src);
- if (retlen >= p2 - src)
+ if (retlen >= p2 - src) {
+ free(ret);
return NULL;
+ }
/* move target pointer (p) */
p += p2 - src;
More information about the lxc-devel
mailing list