]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
storage: Resource leak 2406/head 2408/head
authorDonghwa Jeong <dh48.jeong@samsung.com>
Fri, 15 Jun 2018 02:11:48 +0000 (11:11 +0900)
committerDonghwa Jeong <dh48.jeong@samsung.com>
Fri, 15 Jun 2018 02:11:48 +0000 (11:11 +0900)
Signed-off-by: Donghwa Jeong <dh48.jeong@samsung.com>
src/lxc/storage/storage_utils.c

index 6570bb88eaecbce4e15786215682ef4026316fb0..fa8dfaf41d6e12960bce755399a3bb326a8f5ffe 100644 (file)
@@ -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;