mirror of
https://github.com/kdave/btrfs-progs
synced 2025-01-03 04:02:04 +00:00
btrfs-progs: Add all missing btrfs_close_all_devices to standalone tools
This patch add all missing btrfs_close_all_devices() to standalone tools in btrfs progs, to avoid memory leak. Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
da34dbd149
commit
e72cb5de12
@ -508,5 +508,6 @@ int main(int argc, char **argv)
|
|||||||
out:
|
out:
|
||||||
close_ctree(root);
|
close_ctree(root);
|
||||||
free(roots);
|
free(roots);
|
||||||
|
btrfs_close_all_devices();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include "disk-io.h"
|
#include "disk-io.h"
|
||||||
#include "print-tree.h"
|
#include "print-tree.h"
|
||||||
#include "transaction.h"
|
#include "transaction.h"
|
||||||
|
#include "volumes.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
static int print_usage(int ret)
|
static int print_usage(int ret)
|
||||||
@ -428,5 +429,7 @@ no_node:
|
|||||||
printf("uuid %s\n", uuidbuf);
|
printf("uuid %s\n", uuidbuf);
|
||||||
printf("%s\n", PACKAGE_STRING);
|
printf("%s\n", PACKAGE_STRING);
|
||||||
close_root:
|
close_root:
|
||||||
return close_ctree(root);
|
ret = close_ctree(root);
|
||||||
|
btrfs_close_all_devices();
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -216,5 +216,6 @@ int main(int argc, char **argv)
|
|||||||
out:
|
out:
|
||||||
btrfs_find_root_free(&result);
|
btrfs_find_root_free(&result);
|
||||||
close_ctree(root);
|
close_ctree(root);
|
||||||
|
btrfs_close_all_devices();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -359,5 +359,6 @@ close:
|
|||||||
close_ctree(root);
|
close_ctree(root);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
ret = 1;
|
ret = 1;
|
||||||
|
btrfs_close_all_devices();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include "kerncompat.h"
|
#include "kerncompat.h"
|
||||||
#include "ctree.h"
|
#include "ctree.h"
|
||||||
|
#include "volumes.h"
|
||||||
#include "disk-io.h"
|
#include "disk-io.h"
|
||||||
#include "print-tree.h"
|
#include "print-tree.h"
|
||||||
#include "transaction.h"
|
#include "transaction.h"
|
||||||
@ -101,5 +102,6 @@ int main(int ac, char **av)
|
|||||||
*/
|
*/
|
||||||
printf("using SB copy %llu, bytenr %llu\n", (unsigned long long)num,
|
printf("using SB copy %llu, bytenr %llu\n", (unsigned long long)num,
|
||||||
(unsigned long long)bytenr);
|
(unsigned long long)bytenr);
|
||||||
|
btrfs_close_all_devices();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -548,6 +548,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
close_ctree(root);
|
close_ctree(root);
|
||||||
|
btrfs_close_all_devices();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user