Displaying 20 results from an estimated 234 matches for "cleanup_free_string_list".
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 100644
--- a/daem...
2015 Jun 12
1
[PATCH] 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>
---
daemon/btrfs.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index 39392f7..fd93d43 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -409,7 +409,7 @@ umount (c...
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 insertions(...
2020 Apr 15
0
[PATCH nbdkit 7/9] common/utils: Add CLEANUP_FREE_STRING_LIST macro.
...insertions(+)
diff --git a/common/utils/cleanup.h b/common/utils/cleanup.h
index 7070290d..14ffc7ff 100644
--- a/common/utils/cleanup.h
+++ b/common/utils/cleanup.h
@@ -40,6 +40,9 @@
extern void cleanup_free (void *ptr);
#define CLEANUP_FREE __attribute__((cleanup (cleanup_free)))
+extern void cleanup_free_string_list (char ***ptr);
+#define CLEANUP_FREE_STRING_LIST __attribute__((cleanup (cleanup_free_string_list)))
+
extern void cleanup_unlock (pthread_mutex_t **ptr);
#define CLEANUP_UNLOCK __attribute__((cleanup (cleanup_unlock)))
diff --git a/common/utils/cleanup.c b/common/utils/cleanup.c
index fb77805b...
2015 Jun 17
6
[PATCH v4 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
v4: remove some redundant strdup
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 | 70 +++++++++++++++++++...
2015 Jun 15
0
[PATCH v2 3/3] btrfs: use CLEANUP_FREE_STRING_LIST for list free
...ns(+), 2 deletions(-)
diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index c1462fd..5d87f53 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -1704,10 +1704,10 @@ do_btrfs_balance_status (const char *path)
size_t i = 0;
CLEANUP_FREE char *path_buf = NULL;
CLEANUP_FREE char *err = NULL;
+ CLEANUP_FREE_STRING_LIST char **lines = NULL;
char *out;
int r;
guestfs_int_btrfsbalance *ret;
- char **lines;
size_t nlines;
const char *errptr;
int erroffset;
@@ -1830,10 +1830,10 @@ do_btrfs_scrub_status (const char *path)
size_t i = 0;
CLEANUP_FREE char *path_buf = NULL;
CLEANUP_FREE char *e...
2015 Jun 17
0
[PATCH v4 3/3] btrfs: use CLEANUP_FREE_STRING_LIST for list free
...ns(+), 2 deletions(-)
diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index 5361984..88be9ec 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -1692,10 +1692,10 @@ do_btrfs_balance_status (const char *path)
size_t i = 0;
CLEANUP_FREE char *path_buf = NULL;
CLEANUP_FREE char *err = NULL;
+ CLEANUP_FREE_STRING_LIST char **lines = NULL;
char *out;
int r;
guestfs_int_btrfsbalance *ret;
- char **lines;
size_t nlines;
const char *errptr;
int erroffset;
@@ -1817,10 +1817,10 @@ do_btrfs_scrub_status (const char *path)
size_t i = 0;
CLEANUP_FREE char *path_buf = NULL;
CLEANUP_FREE char *e...
2014 Aug 08
3
[PATCH] daemon: add CLEANUP_CLOSE
...sd.c | 9 +++++++++
2 files changed, 12 insertions(+)
diff --git a/daemon/daemon.h b/daemon/daemon.h
index fb74e91..0caad45 100644
--- a/daemon/daemon.h
+++ b/daemon/daemon.h
@@ -173,6 +173,7 @@ asprintf_nowarn (char **strp, const char *fmt, ...)
extern void cleanup_free (void *ptr);
extern void cleanup_free_string_list (void *ptr);
extern void cleanup_unlink_free (void *ptr);
+extern void cleanup_close (void *ptr);
/*-- in names.c (auto-generated) --*/
extern const char *function_names[];
@@ -405,10 +406,12 @@ is_zero (const char *buffer, size_t size)
#define CLEANUP_FREE_STRING_LIST...
2015 Mar 16
0
[PATCH] inspection: add support for systemd .mount files
..._unix (g, fs) == -1)
return -1;
+ if (check_systemd_mounts (g, fs) == -1)
+ return -1;
+
return 0;
}
@@ -981,6 +987,180 @@ check_hostname_freebsd (guestfs_h *g, struct inspect_fs *fs)
}
static int
+check_systemd_mnt (guestfs_h *g, struct inspect_fs *fs, const char *fname)
+{
+ CLEANUP_FREE_STRING_LIST char **entries = NULL;
+ char **entry;
+ char augpath[256];
+ CLEANUP_HASH_FREE Hash_table *md_map = NULL;
+ bool is_bsd = (fs->type == OS_TYPE_FREEBSD ||
+ fs->type == OS_TYPE_NETBSD ||
+ fs->type == OS_TYPE_OPENBSD);
+
+ /* Generate a map of MD device...
2015 Mar 16
2
[PATCH] RFE: Inspection should support systemd mount units
Adds support for systemd .mount files, uses Augeas to extract mount points.
Fixes RHBZ#1113153.
Maros Zatko (1):
inspection: add support for systemd .mount files
src/inspect-fs-unix.c | 240 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 240 insertions(+)
--
1.9.3
2017 Oct 23
1
[PATCH] rescue: initialize CLEANUP pointer variable
...7f48eb1689d0af54.
---
rescue/escape.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rescue/escape.c b/rescue/escape.c
index 3bb69578b..a6af99ae1 100644
--- a/rescue/escape.c
+++ b/rescue/escape.c
@@ -236,7 +236,7 @@ print_help (void)
static void
print_inspector (void)
{
- CLEANUP_FREE_STRING_LIST char **roots;
+ CLEANUP_FREE_STRING_LIST char **roots = NULL;
size_t i;
const char *root;
char *str;
--
2.13.6
2020 Mar 12
8
[PATCH libguestfs 0/3] daemon: Fix various commands which break on NTFS-3g compressed files.
https://bugzilla.redhat.com/show_bug.cgi?id=1811539
Commands including virt-diff which read extended attributes will
sometimes fail on NTFS filesystems that are using system compressed.
The reason is complex, see comment 5 of the bug linked above.
This patch filters out the troublesome xattr. For justification, see
the comment I added in patch 3.
Patch 1 & 2 are refactoring.
I was on the
2017 Mar 22
2
[PATCH] inspect: improve detection of Mageia install discs
...documentation for it is:
+ * - https://wiki.mageia.org/en/Product_id
+ * - http://wiki.mandriva.com/en/Product_id (old URL, defunct)
+ */
+static int
+check_product_id_installer_root (guestfs_h *g, struct inspect_fs *fs,
+ const char *filename)
+{
+ int64_t size;
+ CLEANUP_FREE_STRING_LIST char **lines = NULL;
+ const char *elem;
+ char *saveptr;
+
+ fs->type = OS_TYPE_LINUX;
+
+ /* Don't trust guestfs_head_n not to break with very large files.
+ * Check the file size is something reasonable first.
+ */
+ size = guestfs_filesize (g, filename);
+ if (size == -1)
+...
2013 Jan 25
4
[PATCH 0/3] Use __attribute__((cleanup(...)))
This patch series changes a small part of the library to use
__attribute__((cleanup(...))) to automatically free memory when
pointers go out of the current scope.
In general terms this seems to be a small win although you do have to
use it carefully. For functions where you can completely get rid of
the "exit code paths", it can simplify things. For a good example,
see the
2017 Mar 02
2
[PATCH] parted: add more udev_settle calls.
...;
int r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR,
str_sgdisk, device, "-i", partnum_str, NULL);
@@ -674,6 +681,8 @@ sgdisk_info_extract_field (const char *device, int partnum, const char *field,
return NULL;
}
+ udev_settle ();
+
CLEANUP_FREE_STRING_LIST char **lines = split_lines (err);
if (lines == NULL) {
reply_with_error ("'%s %s -i %i' returned no output",
--
2.9.3
2016 Jan 21
0
[PATCH v3 2/6] daemon: Split out command() functions and CLEANUP_* macros into separate files.
...include <stdlib.h>
+#include <unistd.h>
+
+#include <augeas.h>
+
+#include "cleanups.h"
+
+/* Use by the CLEANUP_* macros. Do not call these directly. */
+void
+cleanup_free (void *ptr)
+{
+ free (* (void **) ptr);
+}
+
+extern void free_strings (char **argv);
+
+void
+cleanup_free_string_list (void *ptr)
+{
+ free_strings (* (char ***) ptr);
+}
+
+void
+cleanup_unlink_free (void *ptr)
+{
+ char *filename = * (char **) ptr;
+
+ if (filename) {
+ unlink (filename);
+ free (filename);
+ }
+}
+
+void
+cleanup_close (void *ptr)
+{
+ int fd = * (int *) ptr;
+
+ if (fd >= 0)
+...
2015 Oct 19
1
Re: [PATCH 2/2] Include resize2fs_P into vfs_min_size.
...ff --git a/daemon/ext2.c b/daemon/ext2.c
> index 0cd6a66..f00e081 100644
> --- a/daemon/ext2.c
> +++ b/daemon/ext2.c
> @@ -279,8 +279,34 @@ do_resize2fs_M (const char *device)
> return 0;
> }
>
> +static int32_t
> +get_block_size (const char *device)
> +{
> + CLEANUP_FREE_STRING_LIST char **params = NULL;
> + const char *block_pattern = "Block size";
> + size_t i;
> + int32_t block_size;
> +
> + params = do_tune2fs_l (device);
This works, yes, although maybe there should be a way to run tune2fs -l
and traverse its output to either build a return ha...
2017 Jun 19
0
[PATCH v7 13/13] daemon: Link guestfsd with libutils.
...eanups.c
+++ b/daemon/cleanups.c
@@ -24,51 +24,7 @@
#include <augeas.h>
-#include "cleanups.h"
-
-/* Use by the CLEANUP_* macros. Do not call these directly. */
-void
-cleanup_free (void *ptr)
-{
- free (* (void **) ptr);
-}
-
-extern void free_strings (char **argv);
-
-void
-cleanup_free_string_list (void *ptr)
-{
- free_strings (* (char ***) ptr);
-}
-
-void
-cleanup_unlink_free (void *ptr)
-{
- char *filename = * (char **) ptr;
-
- if (filename) {
- unlink (filename);
- free (filename);
- }
-}
-
-void
-cleanup_close (void *ptr)
-{
- const int fd = * (int *) ptr;
-
- if (fd >=...
2015 Jun 18
1
[PATCH] btrfs: fix leak in btrfs_scrub_status
...ile changed, 1 insertion(+), 1 deletion(-)
diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index 2f875ae..050bf18 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -1814,7 +1814,7 @@ do_btrfs_scrub_status (const char *path)
CLEANUP_FREE char *path_buf = NULL;
CLEANUP_FREE char *err = NULL;
CLEANUP_FREE_STRING_LIST char **lines = NULL;
- char *out;
+ CLEANUP_FREE char *out = NULL;
int r;
guestfs_int_btrfsscrub *ret;
--
2.1.0
2015 Jun 19
1
[PATCH] btrfs: fix leak in btrfs_balance_status
...t a/daemon/btrfs.c b/daemon/btrfs.c
index 050bf18..8b5779a 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -1688,8 +1688,8 @@ do_btrfs_balance_status (const char *path)
size_t i = 0;
CLEANUP_FREE char *path_buf = NULL;
CLEANUP_FREE char *err = NULL;
+ CLEANUP_FREE char *out = NULL;
CLEANUP_FREE_STRING_LIST char **lines = NULL;
- char *out;
int r;
guestfs_int_btrfsbalance *ret;
size_t nlines;
--
2.1.0