Skip to content

Commit

Permalink
fix memory leaks reported by cppcheck in src/lxc/bdev.c
Browse files Browse the repository at this point in the history
Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
  • Loading branch information
caglar10ur authored and hallyn committed Nov 18, 2013
1 parent dceb6c8 commit 9529609
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lxc/bdev.c
Expand Up @@ -962,8 +962,10 @@ static int lvm_snapshot(const char *orig, const char *path, unsigned long size)
// check if the original lv is backed by a thin pool, in which case we
// cannot specify a size that's different from the original size.
ret = lvm_is_thin_volume(orig);
if (ret == -1)
if (ret == -1) {
free(pathdup);
return -1;
}

if (!ret) {
ret = execlp("lvcreate", "lvcreate", "-s", "-L", sz, "-n", lv, orig, (char *)NULL);
Expand Down Expand Up @@ -1282,6 +1284,7 @@ static int btrfs_subvolume_create(const char *path)
p = strrchr(newfull, '/');
if (!p) {
ERROR("bad path: %s", path);
free(newfull);
return -1;
}
*p = '\0';
Expand Down Expand Up @@ -1418,6 +1421,7 @@ static int btrfs_destroy(struct bdev *orig)
p = strrchr(newfull, '/');
if (!p) {
ERROR("bad path: %s", path);
free(newfull);
return -1;
}
*p = '\0';
Expand Down

0 comments on commit 9529609

Please sign in to comment.