search for: cleanup_free

Displaying 20 results from an estimated 973 matches for "cleanup_free".

2015 Jun 16
1
[PATCH] btrfs: remove unused 'out' variables
...------ 1 file changed, 20 insertions(+), 40 deletions(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index 39392f7..f02acb1 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -1049,7 +1049,6 @@ do_btrfs_quota_enable (const mountable_t *fs, int enable) size_t i = 0; char *fs_buf = NULL; CLEANUP_FREE char *err = NULL; - CLEANUP_FREE char *out = NULL; int r = -1; fs_buf = mount (fs); @@ -1065,7 +1064,7 @@ do_btrfs_quota_enable (const mountable_t *fs, int enable) ADD_ARG (argv, i, fs_buf); ADD_ARG (argv, i, NULL); - r = commandv (&out, &err, argv); + r = commandv (NULL,...
2016 Mar 06
8
[PATCH 0/5] Use less stack.
Various changes/fixes to use smaller stack frames. Rich.
2016 Mar 07
2
[PATCH v2] Use less stack.
...c.c b/builder/pxzcat-c.c index 4b49e74..1f5ceeb 100644 --- a/builder/pxzcat-c.c +++ b/builder/pxzcat-c.c @@ -250,8 +250,8 @@ parse_indexes (value filenamev, int fd) { lzma_ret r; off_t pos, index_size; - uint8_t footer[LZMA_STREAM_HEADER_SIZE]; - uint8_t header[LZMA_STREAM_HEADER_SIZE]; + CLEANUP_FREE uint8_t *footer = NULL; + CLEANUP_FREE uint8_t *header = NULL; lzma_stream_flags footer_flags; lzma_stream_flags header_flags; lzma_stream strm = LZMA_STREAM_INIT; @@ -260,6 +260,13 @@ parse_indexes (value filenamev, int fd) lzma_index *this_index = NULL; lzma_vli stream_padding = 0...
2015 Oct 16
1
[PATCH] inspect: Include more information for augeas parse errors (RHBZ#1229119)
...++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/src/inspect-fs-unix.c b/src/inspect-fs-unix.c index 968aa40..4fac7f4 100644 --- a/src/inspect-fs-unix.c +++ b/src/inspect-fs-unix.c @@ -1985,7 +1985,6 @@ inspect_with_augeas (guestfs_h *g, struct inspect_fs *fs, CLEANUP_FREE char *pathexpr = NULL; CLEANUP_FREE_STRING_LIST char **matches = NULL; char **match; - size_t len; /* Security: Refuse to do this if a config file is too large. */ for (i = 0; configfiles[i] != NULL; ++i) { @@ -2023,16 +2022,33 @@ inspect_with_augeas (guestfs_h *g, struct inspect_fs...
2013 Jan 25
4
[PATCH 0/3] Use __attribute__((cleanup(...)))
...get rid of the "exit code paths", it can simplify things. For a good example, see the 'inspect-icon.c:icon_windows_xp' function before and after the change. For most functions there is no change or a minor simplification. It can however cause problems if you accidentally put a CLEANUP_FREE annotation on a pointer which is actually returned from the function, or if you explicitly free something. If we make this change, then the library will leak memory when compiled with something that isn't GCC/LLVM. It's likely we have other dependencies on GCC, since we've never serio...
2016 Jan 15
1
[PATCH] daemon: resolve paths for ll and llz
...;ls' won't - * necessarily exist in the chroot), this command can be used to escape - * from the sysroot (eg. 'll /..'). This command is not meant for - * serious use anyway, just for quick interactive sessions. - */ - char * do_ll (const char *path) { int r; char *out; CLEANUP_FREE char *err = NULL; + CLEANUP_FREE char *rpath = NULL; CLEANUP_FREE char *spath = NULL; - spath = sysroot_path (path); + CHROOT_IN; + rpath = realpath (path, NULL); + CHROOT_OUT; + if (rpath == NULL) { + reply_with_perror ("%s", path); + return NULL; + } + + spath = sysro...
2015 Mar 16
2
[PATCH] btrfs-qgroup-show: add check for "--raw"
...uld check wheter 'btrfs qgroup show' support '--raw' + * option by checking the output of + * 'btrfs qgroup show' support --help' command. + */ +static int +test_btrfs_qgroup_show_raw_opt (void) +{ + static int result = -1; + if (result > 0) + return result; + + CLEANUP_FREE char *err = NULL; + CLEANUP_FREE char *out = NULL; + + int r = commandr (&out, &err, str_btrfs, "qgroup", "show", "--help", NULL); + + if (r == -1) { + reply_with_error ("btrfs qgroup show --help: %s", err); + return -1; + } + + if (!strstr...
2015 Jun 12
1
[PATCH v2] btrfs: use CLEANUP_FREE_STRING_LIST for list free
As Pino's comment, we should take advantage of macro CLEANUP_FREE_STRING_LIST. Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com> --- v2: initialize variable of CLEANUP_FREE_STRING_LIST to null daemon/btrfs.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index 39392f7..3ca39ab 10064...
2014 Dec 11
1
Re: [PATCH v2 01/11] daemon: btrfs: add helper functions mount and umount
...> +static char > +*mount (const mountable_t *fs) > +{ > + char *fs_buf = NULL; You shouldn't initialize fs_buf to NULL here, since it prevents the compiler from detecting uninitialized use of fs_buf. The reason it was initialized to NULL in the previous code was because it was a CLEANUP_FREE function (and those have to be initialized almost always). You have correctly removed CLEANUP_FREE, but not the initialization of NULL. > + if (fs->type == MOUNTABLE_PATH) { > + return sysroot_path (fs->device); There's a whole chunk of code missing in here, starting with: &...
2020 Mar 16
0
[PATCH libguestfs v2 3/3] daemon: xattr: Filter out user.WofCompressedData from xattrs (RHBZ#1811539).
...ides other attributes. + */ +static bool +not_hidden_xattr (const char *attrname) +{ + return STRNEQ (attrname, "user.WofCompressedData"); +} + static int compare_xattrs (const void *vxa1, const void *vxa2) { @@ -132,6 +157,7 @@ getxattrs (const char *path, { ssize_t len, vlen; CLEANUP_FREE char *buf = NULL; + CLEANUP_FREE /* not string list */ char **names_unfiltered = NULL; CLEANUP_FREE /* not string list */ char **names = NULL; size_t i; guestfs_int_xattr_list *r = NULL; @@ -141,7 +167,10 @@ getxattrs (const char *path, /* _listxattrs issues reply_with_perror already...
2020 Oct 06
2
Re: [PATCH common v2 4/4] options: Ignore errors from guestfs_luks_uuid.
...t;@@ -25,6 +25,7 @@ > > #include <stdio.h> > #include <stdlib.h> >+#include <stdbool.h> > #include <string.h> > #include <libintl.h> > #include <error.h> >@@ -82,11 +83,23 @@ inspect_do_decrypt (guestfs_h *g, struct key_store *ks) > CLEANUP_FREE char *type = guestfs_vfs_type (g, partitions[i]); > if (type && > (STREQ (type, "crypto_LUKS") || STREQ (type, "BitLocker"))) { >+ bool is_bitlocker = STREQ (type, "BitLocker"); > char mapname[32]; > make_mapname (par...
2014 Dec 26
10
[PATCH 0/5] btrfs: add API for btrfs filesystem, check and scrub
Hi, There is one problem: btrfs_filesystem_set_label just doesnt work, giving error message: libguestfs: error: btrfs_filesystem_set_label: /: ERROR: unable to set label Bad address I'm almost sure the patch has no problem, but can't figure out what's the cause. So patch 5 is only for review. Other APIs have no problem. Regards, Hu Hu Tao (5): New API: btrfs_scrub New API:
2014 Dec 11
14
[PATCH v2 00/11] btrfs support part2: qgroup/quota commands
Hi, This is v2 series to add support to btrfs qgroup related commands, inclduing quota commands, and two leftover of subvolume commands. Regards, Hu changes: v2: - add tests for new APIs - combine btrfs_quota_enable and btrfs_quota_disable - following APIs changed to operate on Mountable_or_Path: btrfs_subvolume_get_default, btrfs_quota_enable, btrfs_quota_rescan. Hu Tao (11):
2014 Dec 02
21
[PATCH 0/8] btrfs support part2: qgroup commands
Hi, This series adds support to btrfs qgroup related commands, inclduing quota commands, and two leftover of subvolume commands. Regards, Hu Hu Tao (8): New API: btrfs_subvolume_get_default New API: btrfs_subvolume_show New API: btrfs_quota_enable New API: btrfs_quota_disable New API: btrfs_quota_rescan New API: btrfs_qgroup_limit New API: btrfs_qgroup_create New API:
2014 Dec 12
15
[PATCH v3 00/11] btrfs support part2: qgroup/quota commands
Hi, This is v3 series to add support to btrfs qgroup related commands, inclduing quota commands, and two leftover of subvolume commands. Regards, Hu changes: v3: - don't intialize fs_buf (patch 1) - check the return value of sysroot_path (patch 1) - check fs_buf rather than fs (patch 1) - fprintf (stderr,...) -> reply_with_error() v2: - add tests for new APIs - combine
2015 Jan 16
18
[PATCH 00/16] btrfs: add support to btrfs scrub, balance, rescue and inspect
Hi, This series adds new APIs to support btrfs scrub, balance, rescue and inspect. Some of them don't have tests because: - btrfs_scrub and btrfs_balance completes too early before we can test btrfs_scrub_cancel, btrfs_scrub_resume, btrfs_scrub_status, btrfs_balance_pause, btrfs_balance_cancel, btrfs_balance_resume and btrfs_balance_status. - can't
2020 Oct 07
2
Re: [PATCH common v2 4/4] options: Ignore errors from guestfs_luks_uuid.
...;> >#include <stdlib.h> >> >+#include <stdbool.h> >> >#include <string.h> >> >#include <libintl.h> >> >#include <error.h> >> >@@ -82,11 +83,23 @@ inspect_do_decrypt (guestfs_h *g, struct key_store *ks) >> > CLEANUP_FREE char *type = guestfs_vfs_type (g, partitions[i]); >> > if (type && >> > (STREQ (type, "crypto_LUKS") || STREQ (type, "BitLocker"))) { >> >+ bool is_bitlocker = STREQ (type, "BitLocker"); >> > char mapname[...
2015 Jun 15
7
[PATCH v3 0/3] btrfs: use CLEANUP_FREE_STRING_LIST for list free
As Pino's comment, we should take advantage of macro CLEANUP_FREE_STRING_LIST v3: fix test case failure v2: properly initialize lines Chen Hanxiao (3): do_btrfs_qgroup_show: fix a bad return value do_btrfs_subvolume_list: fix a bad return value btrfs: use CLEANUP_FREE_STRING_LIST for list free daemon/btrfs.c | 20 ++++++++++---------- 1 file changed, 10...
2015 Jan 05
3
Re: [PATCH 5/5] New API: btrfs_filesystem_set_label
...3,3 +1463,36 @@ do_btrfs_filesystem_defragment (const char *path) > > return 0; > } > + > +int > +do_btrfs_filesystem_set_label (const char *path, const char *label) > +{ > + const size_t MAX_ARGS = 64; > + const char *argv[MAX_ARGS]; > + size_t i = 0; > + CLEANUP_FREE char *path_buf = NULL; > + CLEANUP_FREE char *err = NULL; > + CLEANUP_FREE char *out = NULL; > + int r; > + > + path_buf = sysroot_path (path); > + if (path_buf == NULL) { > + reply_with_perror ("malloc"); > + return -1; > + } > + > + ADD_ARG...
2020 Mar 16
6
[PATCH libguestfs v2 0/3] daemon: Fix various commands which break on NTFS-3g compressed files.
v1 here: https://www.redhat.com/archives/libguestfs/2020-March/msg00099.html This one fixes most of the points picked up in review, and does not strdup the strings which should keep down memory usage if that is a concern. Rich.