Use g_autofree instead of gs_free

This commit is contained in:
Matthew Barnes 2015-05-04 17:58:26 -04:00
parent 4f33515316
commit 7a62d64968
67 changed files with 316 additions and 316 deletions

View File

@ -80,7 +80,7 @@ ostree_bootconfig_parser_parse_at (OstreeBootconfigParser *self,
GError **error) GError **error)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_free char *contents = NULL; g_autofree char *contents = NULL;
char **lines = NULL; char **lines = NULL;
char **iter = NULL; char **iter = NULL;

View File

@ -82,7 +82,7 @@ _ostree_bootloader_grub2_query (OstreeBootloader *bootloader,
{ {
GFileInfo *file_info; GFileInfo *file_info;
const char *fname; const char *fname;
gs_free char *subdir_grub_cfg = NULL; g_autofree char *subdir_grub_cfg = NULL;
if (!gs_file_enumerator_iterate (direnum, &file_info, NULL, if (!gs_file_enumerator_iterate (direnum, &file_info, NULL,
cancellable, error)) cancellable, error))
@ -297,9 +297,9 @@ _ostree_bootloader_grub2_write_config (OstreeBootloader *bootloader,
gs_unref_object GSSubprocessContext *procctx = NULL; gs_unref_object GSSubprocessContext *procctx = NULL;
gs_unref_object GSSubprocess *proc = NULL; gs_unref_object GSSubprocess *proc = NULL;
gs_strfreev char **child_env = g_get_environ (); gs_strfreev char **child_env = g_get_environ ();
gs_free char *bootversion_str = g_strdup_printf ("%u", (guint)bootversion); g_autofree char *bootversion_str = g_strdup_printf ("%u", (guint)bootversion);
gs_unref_object GFile *config_path_efi_dir = NULL; gs_unref_object GFile *config_path_efi_dir = NULL;
gs_free char *grub2_mkconfig_chroot = NULL; g_autofree char *grub2_mkconfig_chroot = NULL;
if (ostree_sysroot_get_booted_deployment (self->sysroot) == NULL if (ostree_sysroot_get_booted_deployment (self->sysroot) == NULL
&& g_file_has_parent (self->sysroot->path, NULL)) && g_file_has_parent (self->sysroot->path, NULL))

View File

@ -123,11 +123,11 @@ _ostree_bootloader_syslinux_write_config (OstreeBootloader *bootloader,
gboolean ret = FALSE; gboolean ret = FALSE;
OstreeBootloaderSyslinux *self = OSTREE_BOOTLOADER_SYSLINUX (bootloader); OstreeBootloaderSyslinux *self = OSTREE_BOOTLOADER_SYSLINUX (bootloader);
gs_unref_object GFile *new_config_path = NULL; gs_unref_object GFile *new_config_path = NULL;
gs_free char *config_contents = NULL; g_autofree char *config_contents = NULL;
gs_free char *new_config_contents = NULL; g_autofree char *new_config_contents = NULL;
gs_unref_ptrarray GPtrArray *new_lines = NULL; gs_unref_ptrarray GPtrArray *new_lines = NULL;
gs_unref_ptrarray GPtrArray *tmp_lines = NULL; gs_unref_ptrarray GPtrArray *tmp_lines = NULL;
gs_free char *kernel_arg = NULL; g_autofree char *kernel_arg = NULL;
gboolean saw_default = FALSE; gboolean saw_default = FALSE;
gboolean regenerate_default = FALSE; gboolean regenerate_default = FALSE;
gboolean parsing_label = FALSE; gboolean parsing_label = FALSE;

View File

@ -109,8 +109,8 @@ _ostree_bootloader_uboot_write_config (OstreeBootloader *bootloader,
{ {
OstreeBootloaderUboot *self = OSTREE_BOOTLOADER_UBOOT (bootloader); OstreeBootloaderUboot *self = OSTREE_BOOTLOADER_UBOOT (bootloader);
gs_unref_object GFile *new_config_path = NULL; gs_unref_object GFile *new_config_path = NULL;
gs_free char *config_contents = NULL; g_autofree char *config_contents = NULL;
gs_free char *new_config_contents = NULL; g_autofree char *new_config_contents = NULL;
gs_unref_ptrarray GPtrArray *new_lines = NULL; gs_unref_ptrarray GPtrArray *new_lines = NULL;
/* This should follow the symbolic link to the current bootversion. */ /* This should follow the symbolic link to the current bootversion. */

View File

@ -124,7 +124,7 @@ ostree_parse_refspec (const char *refspec,
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
GMatchInfo *match = NULL; GMatchInfo *match = NULL;
gs_free char *remote = NULL; g_autofree char *remote = NULL;
static gsize regex_initialized; static gsize regex_initialized;
static GRegex *regex; static GRegex *regex;
@ -497,7 +497,7 @@ ostree_content_stream_parse (gboolean compressed,
gs_unref_object GFileInfo *ret_file_info = NULL; gs_unref_object GFileInfo *ret_file_info = NULL;
gs_unref_variant GVariant *ret_xattrs = NULL; gs_unref_variant GVariant *ret_xattrs = NULL;
gs_unref_variant GVariant *file_header = NULL; gs_unref_variant GVariant *file_header = NULL;
gs_free guchar *buf = NULL; g_autofree guchar *buf = NULL;
if (!g_input_stream_read_all (input, if (!g_input_stream_read_all (input,
&archive_header_size, 4, &bytes_read, &archive_header_size, 4, &bytes_read,
@ -683,7 +683,7 @@ ostree_checksum_file_from_input (GFileInfo *file_info,
GError **error) GError **error)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_free guchar *ret_csum = NULL; g_autofree guchar *ret_csum = NULL;
GChecksum *checksum = NULL; GChecksum *checksum = NULL;
checksum = g_checksum_new (G_CHECKSUM_SHA256); checksum = g_checksum_new (G_CHECKSUM_SHA256);
@ -747,7 +747,7 @@ ostree_checksum_file (GFile *f,
gs_unref_object GFileInfo *file_info = NULL; gs_unref_object GFileInfo *file_info = NULL;
gs_unref_object GInputStream *in = NULL; gs_unref_object GInputStream *in = NULL;
gs_unref_variant GVariant *xattrs = NULL; gs_unref_variant GVariant *xattrs = NULL;
gs_free guchar *ret_csum = NULL; g_autofree guchar *ret_csum = NULL;
if (g_cancellable_set_error_if_cancelled (cancellable, error)) if (g_cancellable_set_error_if_cancelled (cancellable, error))
return FALSE; return FALSE;
@ -920,7 +920,7 @@ _ostree_make_temporary_symlink_at (int tmp_dirfd,
GError **error) GError **error)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_free char *tmpname = NULL; g_autofree char *tmpname = NULL;
guint i; guint i;
const int max_attempts = 128; const int max_attempts = 128;
@ -1493,7 +1493,7 @@ _ostree_get_relative_static_delta_part_path (const char *from,
const char *to, const char *to,
guint i) guint i)
{ {
gs_free char *partstr = g_strdup_printf ("%u", i); g_autofree char *partstr = g_strdup_printf ("%u", i);
return _ostree_get_relative_static_delta_path (from, to, partstr); return _ostree_get_relative_static_delta_path (from, to, partstr);
} }

View File

@ -150,7 +150,7 @@ ostree_deployment_clone (OstreeDeployment *self)
if (self->origin) if (self->origin)
{ {
gs_free char *data = NULL; g_autofree char *data = NULL;
gsize len; gsize len;
gboolean success; gboolean success;

View File

@ -35,8 +35,8 @@ get_file_checksum (OstreeDiffFlags flags,
GError **error) GError **error)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_free char *ret_checksum = NULL; g_autofree char *ret_checksum = NULL;
gs_free guchar *csum = NULL; g_autofree guchar *csum = NULL;
if (OSTREE_IS_REPO_FILE (f)) if (OSTREE_IS_REPO_FILE (f))
{ {
@ -129,8 +129,8 @@ diff_files (OstreeDiffFlags flags,
GError **error) GError **error)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_free char *checksum_a = NULL; g_autofree char *checksum_a = NULL;
gs_free char *checksum_b = NULL; g_autofree char *checksum_b = NULL;
OstreeDiffItem *ret_item = NULL; OstreeDiffItem *ret_item = NULL;
if (!get_file_checksum (flags, a, a_info, &checksum_a, cancellable, error)) if (!get_file_checksum (flags, a, a_info, &checksum_a, cancellable, error))
@ -412,7 +412,7 @@ print_diff_item (char prefix,
{ {
if (g_file_is_native (file)) if (g_file_is_native (file))
{ {
gs_free char *relpath = g_file_get_relative_path (base, file); g_autofree char *relpath = g_file_get_relative_path (base, file);
g_print ("%c %s\n", prefix, relpath); g_print ("%c %s\n", prefix, relpath);
} }
else else

View File

@ -404,7 +404,7 @@ on_stream_read (GObject *object,
if (bytes_read > pending->max_size || if (bytes_read > pending->max_size ||
(bytes_read + pending->current_size) > pending->max_size) (bytes_read + pending->current_size) > pending->max_size)
{ {
gs_free char *uristr = soup_uri_to_string (pending->uri, FALSE); g_autofree char *uristr = soup_uri_to_string (pending->uri, FALSE);
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"URI %s exceeded maximum size of %" G_GUINT64_FORMAT " bytes", "URI %s exceeded maximum size of %" G_GUINT64_FORMAT " bytes",
uristr, uristr,
@ -576,8 +576,8 @@ ostree_fetcher_request_uri_internal (OstreeFetcher *self,
} }
else else
{ {
gs_free char *uristring = soup_uri_to_string (uri, FALSE); g_autofree char *uristring = soup_uri_to_string (uri, FALSE);
gs_free char *tmpfile = NULL; g_autofree char *tmpfile = NULL;
struct stat stbuf; struct stat stbuf;
gboolean exists; gboolean exists;
@ -746,7 +746,7 @@ _ostree_fetcher_request_uri_to_membuf (OstreeFetcher *fetcher,
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
const guint8 nulchar = 0; const guint8 nulchar = 0;
gs_free char *ret_contents = NULL; g_autofree char *ret_contents = NULL;
gs_unref_object GMemoryOutputStream *buf = NULL; gs_unref_object GMemoryOutputStream *buf = NULL;
FetchUriSyncData data; FetchUriSyncData data;
g_assert (error != NULL); g_assert (error != NULL);

View File

@ -238,7 +238,7 @@ ostree_gpg_verify_result_lookup (OstreeGpgVerifyResult *result,
const gchar *key_id, const gchar *key_id,
guint *out_signature_index) guint *out_signature_index)
{ {
gs_free char *key_id_upper = NULL; g_autofree char *key_id_upper = NULL;
gpgme_signature_t signature; gpgme_signature_t signature;
guint signature_index; guint signature_index;
gboolean ret = FALSE; gboolean ret = FALSE;

View File

@ -164,7 +164,7 @@ _ostree_kernel_args_append_proc_cmdline (OstreeKernelArgs *kargs,
GError **error) GError **error)
{ {
gs_unref_object GFile *proc_cmdline_path = g_file_new_for_path ("/proc/cmdline"); gs_unref_object GFile *proc_cmdline_path = g_file_new_for_path ("/proc/cmdline");
gs_free char *proc_cmdline = NULL; g_autofree char *proc_cmdline = NULL;
gsize proc_cmdline_len = 0; gsize proc_cmdline_len = 0;
gs_strfreev char **proc_cmdline_args = NULL; gs_strfreev char **proc_cmdline_args = NULL;

View File

@ -328,7 +328,7 @@ metalink_parser_text (GMarkupParseContext *context,
break; break;
case OSTREE_METALINK_STATE_SIZE: case OSTREE_METALINK_STATE_SIZE:
{ {
gs_free char *duped = g_strndup (text, text_len); g_autofree char *duped = g_strndup (text, text_len);
self->size = g_ascii_strtoull (duped, NULL, 10); self->size = g_ascii_strtoull (duped, NULL, 10);
} }
break; break;
@ -356,7 +356,7 @@ metalink_parser_text (GMarkupParseContext *context,
break; break;
case OSTREE_METALINK_STATE_URL: case OSTREE_METALINK_STATE_URL:
{ {
gs_free char *uri_text = g_strndup (text, text_len); g_autofree char *uri_text = g_strndup (text, text_len);
SoupURI *uri = soup_uri_new (uri_text); SoupURI *uri = soup_uri_new (uri_text);
if (uri != NULL) if (uri != NULL)
g_ptr_array_add (self->urls, uri); g_ptr_array_add (self->urls, uri);
@ -433,7 +433,7 @@ on_fetched_url (GObject *src,
struct stat stbuf; struct stat stbuf;
int parent_dfd = _ostree_fetcher_get_dfd (self->metalink->fetcher); int parent_dfd = _ostree_fetcher_get_dfd (self->metalink->fetcher);
gs_unref_object GInputStream *instream = NULL; gs_unref_object GInputStream *instream = NULL;
gs_free char *result = NULL; g_autofree char *result = NULL;
GChecksum *checksum = NULL; GChecksum *checksum = NULL;
result = _ostree_fetcher_request_uri_with_partial_finish ((OstreeFetcher*)src, res, &local_error); result = _ostree_fetcher_request_uri_with_partial_finish ((OstreeFetcher*)src, res, &local_error);

View File

@ -218,7 +218,7 @@ ostree_mutable_tree_lookup (OstreeMutableTree *self,
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_unref_object OstreeMutableTree *ret_subdir = NULL; gs_unref_object OstreeMutableTree *ret_subdir = NULL;
gs_free char *ret_file_checksum = NULL; g_autofree char *ret_file_checksum = NULL;
ret_subdir = ot_gobject_refz (g_hash_table_lookup (self->subdirs, name)); ret_subdir = ot_gobject_refz (g_hash_table_lookup (self->subdirs, name));
if (!ret_subdir) if (!ret_subdir)

View File

@ -41,7 +41,7 @@ checkout_object_for_uncompressed_cache (OstreeRepo *self,
GError **error) GError **error)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_free char *temp_filename = NULL; g_autofree char *temp_filename = NULL;
gs_unref_object GOutputStream *temp_out = NULL; gs_unref_object GOutputStream *temp_out = NULL;
int fd; int fd;
int res; int res;
@ -266,7 +266,7 @@ checkout_file_unioning_from_input_at (OstreeRepo *repo,
GError **error) GError **error)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_free char *temp_filename = NULL; g_autofree char *temp_filename = NULL;
if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_SYMBOLIC_LINK) if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_SYMBOLIC_LINK)
{ {
@ -865,7 +865,7 @@ ostree_repo_checkout_gc (OstreeRepo *self,
{ {
gs_unref_object GFile *objdir = NULL; gs_unref_object GFile *objdir = NULL;
gs_unref_object GFileEnumerator *enumerator = NULL; gs_unref_object GFileEnumerator *enumerator = NULL;
gs_free char *objdir_name = NULL; g_autofree char *objdir_name = NULL;
objdir_name = g_strdup_printf ("%02x", GPOINTER_TO_UINT (key)); objdir_name = g_strdup_printf ("%02x", GPOINTER_TO_UINT (key));
objdir = g_file_get_child (self->uncompressed_objects_dir, objdir_name); objdir = g_file_get_child (self->uncompressed_objects_dir, objdir_name);

View File

@ -458,7 +458,7 @@ _ostree_repo_open_trusted_content_bare (OstreeRepo *self,
GError **error) GError **error)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_free char *temp_filename = NULL; g_autofree char *temp_filename = NULL;
gs_unref_object GOutputStream *ret_stream = NULL; gs_unref_object GOutputStream *ret_stream = NULL;
gboolean have_obj; gboolean have_obj;
char loose_objpath[_OSTREE_LOOSE_PATH_MAX]; char loose_objpath[_OSTREE_LOOSE_PATH_MAX];
@ -536,9 +536,9 @@ write_object (OstreeRepo *self,
const char *actual_checksum; const char *actual_checksum;
gboolean do_commit; gboolean do_commit;
OstreeRepoMode repo_mode; OstreeRepoMode repo_mode;
gs_free char *temp_filename = NULL; g_autofree char *temp_filename = NULL;
gs_unref_object GFile *stored_path = NULL; gs_unref_object GFile *stored_path = NULL;
gs_free guchar *ret_csum = NULL; g_autofree guchar *ret_csum = NULL;
gs_unref_object OstreeChecksumInputStream *checksum_input = NULL; gs_unref_object OstreeChecksumInputStream *checksum_input = NULL;
gs_unref_object GInputStream *file_input = NULL; gs_unref_object GInputStream *file_input = NULL;
gs_unref_object GFileInfo *file_info = NULL; gs_unref_object GFileInfo *file_info = NULL;
@ -775,9 +775,9 @@ write_object (OstreeRepo *self,
{ {
if (G_UNLIKELY (file_object_length > OSTREE_MAX_METADATA_WARN_SIZE)) if (G_UNLIKELY (file_object_length > OSTREE_MAX_METADATA_WARN_SIZE))
{ {
gs_free char *metasize = g_format_size (file_object_length); g_autofree char *metasize = g_format_size (file_object_length);
gs_free char *warnsize = g_format_size (OSTREE_MAX_METADATA_WARN_SIZE); g_autofree char *warnsize = g_format_size (OSTREE_MAX_METADATA_WARN_SIZE);
gs_free char *maxsize = g_format_size (OSTREE_MAX_METADATA_SIZE); g_autofree char *maxsize = g_format_size (OSTREE_MAX_METADATA_SIZE);
g_warning ("metadata object %s is %s, which is larger than the warning threshold of %s." \ g_warning ("metadata object %s is %s, which is larger than the warning threshold of %s." \
" The hard limit on metadata size is %s. Put large content in the tree itself, not in metadata.", " The hard limit on metadata size is %s. Put large content in the tree itself, not in metadata.",
actual_checksum, actual_checksum,
@ -1450,8 +1450,8 @@ ostree_repo_write_metadata (OstreeRepo *self,
if (G_UNLIKELY (g_variant_get_size (normalized) > OSTREE_MAX_METADATA_SIZE)) if (G_UNLIKELY (g_variant_get_size (normalized) > OSTREE_MAX_METADATA_SIZE))
{ {
gs_free char *input_bytes = g_format_size (g_variant_get_size (normalized)); g_autofree char *input_bytes = g_format_size (g_variant_get_size (normalized));
gs_free char *max_bytes = g_format_size (OSTREE_MAX_METADATA_SIZE); g_autofree char *max_bytes = g_format_size (OSTREE_MAX_METADATA_SIZE);
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Metadata object of type '%s' is %s; maximum metadata size is %s", "Metadata object of type '%s' is %s; maximum metadata size is %s",
ostree_object_type_to_string (objtype), ostree_object_type_to_string (objtype),
@ -1852,10 +1852,10 @@ ostree_repo_write_commit (OstreeRepo *self,
GError **error) GError **error)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_free char *ret_commit = NULL; g_autofree char *ret_commit = NULL;
gs_unref_variant GVariant *commit = NULL; gs_unref_variant GVariant *commit = NULL;
gs_unref_variant GVariant *new_metadata = NULL; gs_unref_variant GVariant *new_metadata = NULL;
gs_free guchar *commit_csum = NULL; g_autofree guchar *commit_csum = NULL;
GDateTime *now = NULL; GDateTime *now = NULL;
OstreeRepoFile *repo_root = OSTREE_REPO_FILE (root); OstreeRepoFile *repo_root = OSTREE_REPO_FILE (root);
@ -2213,7 +2213,7 @@ get_modified_xattrs (OstreeRepo *self,
if (modifier && modifier->sepolicy) if (modifier && modifier->sepolicy)
{ {
gs_free char *label = NULL; g_autofree char *label = NULL;
if (!ostree_sepolicy_get_label (modifier->sepolicy, relpath, if (!ostree_sepolicy_get_label (modifier->sepolicy, relpath,
g_file_info_get_attribute_uint32 (file_info, "unix::mode"), g_file_info_get_attribute_uint32 (file_info, "unix::mode"),
@ -2279,7 +2279,7 @@ write_directory_content_to_mtree_internal (OstreeRepo *self,
gs_unref_object GFile *child = NULL; gs_unref_object GFile *child = NULL;
gs_unref_object GFileInfo *modified_info = NULL; gs_unref_object GFileInfo *modified_info = NULL;
gs_unref_object OstreeMutableTree *child_mtree = NULL; gs_unref_object OstreeMutableTree *child_mtree = NULL;
gs_free char *child_relpath = NULL; g_autofree char *child_relpath = NULL;
const char *name; const char *name;
GFileType file_type; GFileType file_type;
OstreeRepoCommitFilterResult filter_result; OstreeRepoCommitFilterResult filter_result;
@ -2359,8 +2359,8 @@ write_directory_content_to_mtree_internal (OstreeRepo *self,
gs_unref_object GInputStream *file_input = NULL; gs_unref_object GInputStream *file_input = NULL;
gs_unref_variant GVariant *xattrs = NULL; gs_unref_variant GVariant *xattrs = NULL;
gs_unref_object GInputStream *file_object_input = NULL; gs_unref_object GInputStream *file_object_input = NULL;
gs_free guchar *child_file_csum = NULL; g_autofree guchar *child_file_csum = NULL;
gs_free char *tmp_checksum = NULL; g_autofree char *tmp_checksum = NULL;
loose_checksum = devino_cache_lookup (self, loose_checksum = devino_cache_lookup (self,
g_file_info_get_attribute_uint32 (child_info, "unix::device"), g_file_info_get_attribute_uint32 (child_info, "unix::device"),
@ -2466,9 +2466,9 @@ write_directory_to_mtree_internal (OstreeRepo *self,
{ {
gs_unref_object GFileInfo *modified_info = NULL; gs_unref_object GFileInfo *modified_info = NULL;
gs_unref_variant GVariant *xattrs = NULL; gs_unref_variant GVariant *xattrs = NULL;
gs_free guchar *child_file_csum = NULL; g_autofree guchar *child_file_csum = NULL;
gs_free char *tmp_checksum = NULL; g_autofree char *tmp_checksum = NULL;
gs_free char *relpath = NULL; g_autofree char *relpath = NULL;
child_info = g_file_query_info (dir, OSTREE_GIO_FAST_QUERYINFO, child_info = g_file_query_info (dir, OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
@ -2548,9 +2548,9 @@ write_dfd_iter_to_mtree_internal (OstreeRepo *self,
gs_unref_object GFileInfo *child_info = NULL; gs_unref_object GFileInfo *child_info = NULL;
gs_unref_object GFileInfo *modified_info = NULL; gs_unref_object GFileInfo *modified_info = NULL;
gs_unref_variant GVariant *xattrs = NULL; gs_unref_variant GVariant *xattrs = NULL;
gs_free guchar *child_file_csum = NULL; g_autofree guchar *child_file_csum = NULL;
gs_free char *tmp_checksum = NULL; g_autofree char *tmp_checksum = NULL;
gs_free char *relpath = NULL; g_autofree char *relpath = NULL;
OstreeRepoCommitFilterResult filter_result; OstreeRepoCommitFilterResult filter_result;
struct stat dir_stbuf; struct stat dir_stbuf;
@ -2759,7 +2759,7 @@ ostree_repo_write_mtree (OstreeRepo *self,
gs_unref_hashtable GHashTable *dir_metadata_checksums = NULL; gs_unref_hashtable GHashTable *dir_metadata_checksums = NULL;
gs_unref_hashtable GHashTable *dir_contents_checksums = NULL; gs_unref_hashtable GHashTable *dir_contents_checksums = NULL;
gs_unref_variant GVariant *serialized_tree = NULL; gs_unref_variant GVariant *serialized_tree = NULL;
gs_free guchar *contents_csum = NULL; g_autofree guchar *contents_csum = NULL;
char contents_checksum_buf[65]; char contents_checksum_buf[65];
dir_contents_checksums = g_hash_table_new_full (g_str_hash, g_str_equal, dir_contents_checksums = g_hash_table_new_full (g_str_hash, g_str_equal,

View File

@ -218,7 +218,7 @@ do_resolve_nonroot (OstreeRepoFile *self,
gs_unref_variant GVariant *tree_metadata = NULL; gs_unref_variant GVariant *tree_metadata = NULL;
gs_unref_variant GVariant *contents_csum_v = NULL; gs_unref_variant GVariant *contents_csum_v = NULL;
gs_unref_variant GVariant *metadata_csum_v = NULL; gs_unref_variant GVariant *metadata_csum_v = NULL;
gs_free char *tmp_checksum = NULL; g_autofree char *tmp_checksum = NULL;
if (!ostree_repo_file_ensure_resolved (self->parent, error)) if (!ostree_repo_file_ensure_resolved (self->parent, error))
goto out; goto out;

View File

@ -128,10 +128,10 @@ write_libarchive_entry_to_mtree (OstreeRepo *self,
gs_unref_object OstreeMutableTree *subdir = NULL; gs_unref_object OstreeMutableTree *subdir = NULL;
gs_unref_object OstreeMutableTree *parent = NULL; gs_unref_object OstreeMutableTree *parent = NULL;
gs_unref_object OstreeMutableTree *hardlink_source_parent = NULL; gs_unref_object OstreeMutableTree *hardlink_source_parent = NULL;
gs_free char *hardlink_source_checksum = NULL; g_autofree char *hardlink_source_checksum = NULL;
gs_unref_object OstreeMutableTree *hardlink_source_subdir = NULL; gs_unref_object OstreeMutableTree *hardlink_source_subdir = NULL;
gs_free guchar *tmp_csum = NULL; g_autofree guchar *tmp_csum = NULL;
gs_free char *tmp_checksum = NULL; g_autofree char *tmp_checksum = NULL;
pathname = archive_entry_pathname (entry); pathname = archive_entry_pathname (entry);
@ -295,7 +295,7 @@ ostree_repo_write_archive_to_mtree (OstreeRepo *self,
struct archive_entry *entry; struct archive_entry *entry;
int r; int r;
gs_unref_object GFileInfo *tmp_dir_info = NULL; gs_unref_object GFileInfo *tmp_dir_info = NULL;
gs_free guchar *tmp_csum = NULL; g_autofree guchar *tmp_csum = NULL;
a = archive_read_new (); a = archive_read_new ();
#ifdef HAVE_ARCHIVE_READ_SUPPORT_FILTER_ALL #ifdef HAVE_ARCHIVE_READ_SUPPORT_FILTER_ALL

View File

@ -233,8 +233,8 @@ ostree_repo_prune (OstreeRepo *self,
const char *dash = strchr (deltaname, '-'); const char *dash = strchr (deltaname, '-');
const char *to = NULL; const char *to = NULL;
gboolean have_commit; gboolean have_commit;
gs_free char *from = NULL; g_autofree char *from = NULL;
gs_free char *deltadir = NULL; g_autofree char *deltadir = NULL;
if (!dash) if (!dash)
{ {

View File

@ -219,8 +219,8 @@ update_progress (gpointer user_data)
if (pull_data->fetching_sync_uri) if (pull_data->fetching_sync_uri)
{ {
gs_free char *uri_string = soup_uri_to_string (pull_data->fetching_sync_uri, TRUE); g_autofree char *uri_string = soup_uri_to_string (pull_data->fetching_sync_uri, TRUE);
gs_free char *status_string = g_strconcat ("Requesting ", uri_string, NULL); g_autofree char *status_string = g_strconcat ("Requesting ", uri_string, NULL);
ostree_async_progress_set_status (pull_data->progress, status_string); ostree_async_progress_set_status (pull_data->progress, status_string);
} }
else else
@ -324,7 +324,7 @@ fetch_uri_contents_utf8_sync (OtPullData *pull_data,
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_unref_bytes GBytes *bytes = NULL; gs_unref_bytes GBytes *bytes = NULL;
gs_free char *ret_contents = NULL; g_autofree char *ret_contents = NULL;
gsize len; gsize len;
if (!fetch_uri_contents_membuf_sync (pull_data, uri, TRUE, FALSE, if (!fetch_uri_contents_membuf_sync (pull_data, uri, TRUE, FALSE,
@ -395,7 +395,7 @@ scan_dirtree_object (OtPullData *pull_data,
const char *filename; const char *filename;
gboolean file_is_stored; gboolean file_is_stored;
gs_unref_variant GVariant *csum = NULL; gs_unref_variant GVariant *csum = NULL;
gs_free char *file_checksum = NULL; g_autofree char *file_checksum = NULL;
g_variant_get_child (files_variant, i, "(&s@ay)", &filename, &csum); g_variant_get_child (files_variant, i, "(&s@ay)", &filename, &csum);
@ -427,7 +427,7 @@ scan_dirtree_object (OtPullData *pull_data,
{ {
const char *subpath = NULL; const char *subpath = NULL;
const char *nextslash = NULL; const char *nextslash = NULL;
gs_free char *dir_data = NULL; g_autofree char *dir_data = NULL;
g_assert (pull_data->dir[0] == '/'); // assert it starts with / like "/usr/share/rpm" g_assert (pull_data->dir[0] == '/'); // assert it starts with / like "/usr/share/rpm"
subpath = pull_data->dir + 1; // refers to name minus / like "usr/share/rpm" subpath = pull_data->dir + 1; // refers to name minus / like "usr/share/rpm"
@ -484,7 +484,7 @@ fetch_ref_contents (OtPullData *pull_data,
GError **error) GError **error)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_free char *ret_contents = NULL; g_autofree char *ret_contents = NULL;
SoupURI *target_uri = NULL; SoupURI *target_uri = NULL;
target_uri = suburi_new (pull_data->base_uri, "refs", "heads", ref, NULL); target_uri = suburi_new (pull_data->base_uri, "refs", "heads", ref, NULL);
@ -555,8 +555,8 @@ content_fetch_on_write_complete (GObject *object,
GError **error = &local_error; GError **error = &local_error;
OstreeObjectType objtype; OstreeObjectType objtype;
const char *expected_checksum; const char *expected_checksum;
gs_free guchar *csum = NULL; g_autofree guchar *csum = NULL;
gs_free char *checksum = NULL; g_autofree char *checksum = NULL;
if (!ostree_repo_write_content_finish ((OstreeRepo*)object, result, if (!ostree_repo_write_content_finish ((OstreeRepo*)object, result,
&csum, error)) &csum, error))
@ -600,7 +600,7 @@ content_fetch_on_complete (GObject *object,
gs_unref_variant GVariant *xattrs = NULL; gs_unref_variant GVariant *xattrs = NULL;
gs_unref_object GInputStream *file_in = NULL; gs_unref_object GInputStream *file_in = NULL;
gs_unref_object GInputStream *object_input = NULL; gs_unref_object GInputStream *object_input = NULL;
gs_free char *temp_path = NULL; g_autofree char *temp_path = NULL;
const char *checksum; const char *checksum;
OstreeObjectType objtype; OstreeObjectType objtype;
@ -677,9 +677,9 @@ on_metadata_written (GObject *object,
GError **error = &local_error; GError **error = &local_error;
const char *expected_checksum; const char *expected_checksum;
OstreeObjectType objtype; OstreeObjectType objtype;
gs_free char *checksum = NULL; g_autofree char *checksum = NULL;
gs_free guchar *csum = NULL; g_autofree guchar *csum = NULL;
gs_free char *stringified_object = NULL; g_autofree char *stringified_object = NULL;
if (!ostree_repo_write_metadata_finish ((OstreeRepo*)object, result, if (!ostree_repo_write_metadata_finish ((OstreeRepo*)object, result,
&csum, error)) &csum, error))
@ -721,7 +721,7 @@ meta_fetch_on_complete (GObject *object,
FetchObjectData *fetch_data = user_data; FetchObjectData *fetch_data = user_data;
OtPullData *pull_data = fetch_data->pull_data; OtPullData *pull_data = fetch_data->pull_data;
gs_unref_variant GVariant *metadata = NULL; gs_unref_variant GVariant *metadata = NULL;
gs_free char *temp_path = NULL; g_autofree char *temp_path = NULL;
const char *checksum; const char *checksum;
OstreeObjectType objtype; OstreeObjectType objtype;
GError *local_error = NULL; GError *local_error = NULL;
@ -854,10 +854,10 @@ static_deltapart_fetch_on_complete (GObject *object,
FetchStaticDeltaData *fetch_data = user_data; FetchStaticDeltaData *fetch_data = user_data;
OtPullData *pull_data = fetch_data->pull_data; OtPullData *pull_data = fetch_data->pull_data;
gs_unref_variant GVariant *metadata = NULL; gs_unref_variant GVariant *metadata = NULL;
gs_free char *temp_path = NULL; g_autofree char *temp_path = NULL;
gs_unref_object GInputStream *in = NULL; gs_unref_object GInputStream *in = NULL;
gs_free char *actual_checksum = NULL; g_autofree char *actual_checksum = NULL;
gs_free guint8 *csum = NULL; g_autofree guint8 *csum = NULL;
GError *local_error = NULL; GError *local_error = NULL;
GError **error = &local_error; GError **error = &local_error;
gs_fd_close int fd = -1; gs_fd_close int fd = -1;
@ -1080,7 +1080,7 @@ scan_one_metadata_object_c (OtPullData *pull_data,
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_unref_variant GVariant *object = NULL; gs_unref_variant GVariant *object = NULL;
gs_free char *tmp_checksum = NULL; g_autofree char *tmp_checksum = NULL;
gboolean is_requested; gboolean is_requested;
gboolean is_stored; gboolean is_stored;
@ -1187,7 +1187,7 @@ enqueue_one_object_request (OtPullData *pull_data,
SoupURI *obj_uri = NULL; SoupURI *obj_uri = NULL;
gboolean is_meta; gboolean is_meta;
FetchObjectData *fetch_data; FetchObjectData *fetch_data;
gs_free char *objpath = NULL; g_autofree char *objpath = NULL;
guint64 *expected_max_size_p; guint64 *expected_max_size_p;
guint64 expected_max_size; guint64 expected_max_size;
@ -1250,7 +1250,7 @@ repo_get_remote_option_inherit (OstreeRepo *self,
GError **error) GError **error)
{ {
OstreeRepo *parent = ostree_repo_get_parent (self); OstreeRepo *parent = ostree_repo_get_parent (self);
gs_free char *value = NULL; g_autofree char *value = NULL;
gboolean ret = FALSE; gboolean ret = FALSE;
if (!_ostree_repo_get_remote_option (self, remote_name, option_name, NULL, &value, error)) if (!_ostree_repo_get_remote_option (self, remote_name, option_name, NULL, &value, error))
@ -1278,7 +1278,7 @@ load_remote_repo_config (OtPullData *pull_data,
GError **error) GError **error)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_free char *contents = NULL; g_autofree char *contents = NULL;
GKeyFile *ret_keyfile = NULL; GKeyFile *ret_keyfile = NULL;
SoupURI *target_uri = NULL; SoupURI *target_uri = NULL;
@ -1310,7 +1310,7 @@ fetch_metadata_to_verify_delta_superblock (OtPullData *pull_data,
GError **error) GError **error)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_free char *meta_path = _ostree_get_relative_static_delta_detachedmeta_path (from_revision, checksum); g_autofree char *meta_path = _ostree_get_relative_static_delta_detachedmeta_path (from_revision, checksum);
gs_unref_bytes GBytes *detached_meta_data = NULL; gs_unref_bytes GBytes *detached_meta_data = NULL;
SoupURI *target_uri = NULL; SoupURI *target_uri = NULL;
gs_unref_variant GVariant *metadata = NULL; gs_unref_variant GVariant *metadata = NULL;
@ -1349,7 +1349,7 @@ request_static_delta_superblock_sync (OtPullData *pull_data,
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_unref_variant GVariant *ret_delta_superblock = NULL; gs_unref_variant GVariant *ret_delta_superblock = NULL;
gs_free char *delta_name = g_autofree char *delta_name =
_ostree_get_relative_static_delta_superblock_path (from_revision, to_revision); _ostree_get_relative_static_delta_superblock_path (from_revision, to_revision);
gs_unref_bytes GBytes *delta_superblock_data = NULL; gs_unref_bytes GBytes *delta_superblock_data = NULL;
gs_unref_bytes GBytes *delta_meta_data = NULL; gs_unref_bytes GBytes *delta_meta_data = NULL;
@ -1393,7 +1393,7 @@ process_one_static_delta_fallback (OtPullData *pull_data,
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_unref_variant GVariant *csum_v = NULL; gs_unref_variant GVariant *csum_v = NULL;
gs_free char *checksum = NULL; g_autofree char *checksum = NULL;
guint8 objtype_y; guint8 objtype_y;
OstreeObjectType objtype; OstreeObjectType objtype;
gboolean is_stored; gboolean is_stored;
@ -1479,7 +1479,7 @@ process_one_static_delta (OtPullData *pull_data,
/* Write the to-commit object */ /* Write the to-commit object */
{ {
gs_unref_variant GVariant *to_csum_v = NULL; gs_unref_variant GVariant *to_csum_v = NULL;
gs_free char *to_checksum = NULL; g_autofree char *to_checksum = NULL;
gs_unref_variant GVariant *to_commit = NULL; gs_unref_variant GVariant *to_commit = NULL;
gboolean have_to_commit; gboolean have_to_commit;
@ -1519,7 +1519,7 @@ process_one_static_delta (OtPullData *pull_data,
gs_unref_variant GVariant *header = NULL; gs_unref_variant GVariant *header = NULL;
gboolean have_all = FALSE; gboolean have_all = FALSE;
SoupURI *target_uri = NULL; SoupURI *target_uri = NULL;
gs_free char *deltapart_path = NULL; g_autofree char *deltapart_path = NULL;
FetchStaticDeltaData *fetch_data; FetchStaticDeltaData *fetch_data;
gs_unref_variant GVariant *csum_v = NULL; gs_unref_variant GVariant *csum_v = NULL;
gs_unref_variant GVariant *objects = NULL; gs_unref_variant GVariant *objects = NULL;
@ -1633,13 +1633,13 @@ ostree_repo_pull_with_options (OstreeRepo *self,
gpointer key, value; gpointer key, value;
gboolean tls_permissive = FALSE; gboolean tls_permissive = FALSE;
OstreeFetcherConfigFlags fetcher_flags = 0; OstreeFetcherConfigFlags fetcher_flags = 0;
gs_free char *remote_key = NULL; g_autofree char *remote_key = NULL;
gs_free char *path = NULL; g_autofree char *path = NULL;
gs_free char *baseurl = NULL; g_autofree char *baseurl = NULL;
gs_free char *metalink_url_str = NULL; g_autofree char *metalink_url_str = NULL;
gs_unref_hashtable GHashTable *requested_refs_to_fetch = NULL; gs_unref_hashtable GHashTable *requested_refs_to_fetch = NULL;
gs_unref_hashtable GHashTable *commits_to_fetch = NULL; gs_unref_hashtable GHashTable *commits_to_fetch = NULL;
gs_free char *remote_mode_str = NULL; g_autofree char *remote_mode_str = NULL;
gs_unref_object OstreeMetalink *metalink = NULL; gs_unref_object OstreeMetalink *metalink = NULL;
OtPullData pull_data_real = { 0, }; OtPullData pull_data_real = { 0, };
OtPullData *pull_data = &pull_data_real; OtPullData *pull_data = &pull_data_real;
@ -1728,8 +1728,8 @@ ostree_repo_pull_with_options (OstreeRepo *self,
commits_to_fetch = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); commits_to_fetch = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
{ {
gs_free char *tls_client_cert_path = NULL; g_autofree char *tls_client_cert_path = NULL;
gs_free char *tls_client_key_path = NULL; g_autofree char *tls_client_key_path = NULL;
if (!_ostree_repo_get_remote_option (self, if (!_ostree_repo_get_remote_option (self,
remote_name_or_baseurl, "tls-client-cert-path", remote_name_or_baseurl, "tls-client-cert-path",
@ -1764,7 +1764,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
} }
{ {
gs_free char *tls_ca_path = NULL; g_autofree char *tls_ca_path = NULL;
gs_unref_object GTlsDatabase *db = NULL; gs_unref_object GTlsDatabase *db = NULL;
if (!_ostree_repo_get_remote_option (self, if (!_ostree_repo_get_remote_option (self,
@ -1783,7 +1783,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
} }
{ {
gs_free char *http_proxy = NULL; g_autofree char *http_proxy = NULL;
if (!_ostree_repo_get_remote_option (self, if (!_ostree_repo_get_remote_option (self,
remote_name_or_baseurl, "proxy", remote_name_or_baseurl, "proxy",
@ -1826,7 +1826,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
} }
else else
{ {
gs_free char *metalink_data = NULL; g_autofree char *metalink_data = NULL;
SoupURI *metalink_uri = soup_uri_new (metalink_url_str); SoupURI *metalink_uri = soup_uri_new (metalink_url_str);
SoupURI *target_uri = NULL; SoupURI *target_uri = NULL;
gs_fd_close int fd = -1; gs_fd_close int fd = -1;
@ -1852,7 +1852,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
goto out; goto out;
{ {
gs_free char *repo_base = g_path_get_dirname (soup_uri_get_path (target_uri)); g_autofree char *repo_base = g_path_get_dirname (soup_uri_get_path (target_uri));
pull_data->base_uri = soup_uri_copy (target_uri); pull_data->base_uri = soup_uri_copy (target_uri);
soup_uri_set_path (pull_data->base_uri, repo_base); soup_uri_set_path (pull_data->base_uri, repo_base);
} }
@ -1908,7 +1908,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
{ {
SoupURI *summary_uri = NULL; SoupURI *summary_uri = NULL;
gs_unref_bytes GBytes *bytes = NULL; gs_unref_bytes GBytes *bytes = NULL;
gs_free char *ret_contents = NULL; g_autofree char *ret_contents = NULL;
summary_uri = suburi_new (pull_data->base_uri, "summary", NULL); summary_uri = suburi_new (pull_data->base_uri, "summary", NULL);
if (!fetch_uri_contents_membuf_sync (pull_data, summary_uri, FALSE, TRUE, if (!fetch_uri_contents_membuf_sync (pull_data, summary_uri, FALSE, TRUE,
@ -2044,7 +2044,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
g_hash_table_iter_init (&hash_iter, requested_refs_to_fetch); g_hash_table_iter_init (&hash_iter, requested_refs_to_fetch);
while (g_hash_table_iter_next (&hash_iter, &key, &value)) while (g_hash_table_iter_next (&hash_iter, &key, &value))
{ {
gs_free char *from_revision = NULL; g_autofree char *from_revision = NULL;
const char *ref = key; const char *ref = key;
const char *to_revision = value; const char *to_revision = value;
GVariant *delta_superblock = NULL; GVariant *delta_superblock = NULL;
@ -2109,8 +2109,8 @@ ostree_repo_pull_with_options (OstreeRepo *self,
{ {
const char *ref = key; const char *ref = key;
const char *checksum = value; const char *checksum = value;
gs_free char *remote_ref = NULL; g_autofree char *remote_ref = NULL;
gs_free char *original_rev = NULL; g_autofree char *original_rev = NULL;
if (pull_data->remote_name) if (pull_data->remote_name)
remote_ref = g_strdup_printf ("%s/%s", pull_data->remote_name, ref); remote_ref = g_strdup_printf ("%s/%s", pull_data->remote_name, ref);

View File

@ -176,7 +176,7 @@ resolve_refspec_fallback (OstreeRepo *self,
GError **error) GError **error)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_free char *ret_rev = NULL; g_autofree char *ret_rev = NULL;
if (self->parent_repo) if (self->parent_repo)
{ {
@ -211,7 +211,7 @@ resolve_refspec (OstreeRepo *self,
gboolean ret = FALSE; gboolean ret = FALSE;
__attribute__((unused)) GCancellable *cancellable = NULL; __attribute__((unused)) GCancellable *cancellable = NULL;
GError *temp_error = NULL; GError *temp_error = NULL;
gs_free char *ret_rev = NULL; g_autofree char *ret_rev = NULL;
gs_unref_object GFile *child = NULL; gs_unref_object GFile *child = NULL;
g_return_val_if_fail (ref != NULL, FALSE); g_return_val_if_fail (ref != NULL, FALSE);
@ -294,7 +294,7 @@ ostree_repo_resolve_partial_checksum (OstreeRepo *self,
static const char hexchars[] = "0123456789abcdef"; static const char hexchars[] = "0123456789abcdef";
gsize off; gsize off;
gs_unref_hashtable GHashTable *ref_list = NULL; gs_unref_hashtable GHashTable *ref_list = NULL;
gs_free char *ret_rev = NULL; g_autofree char *ret_rev = NULL;
guint length; guint length;
const char *checksum = NULL; const char *checksum = NULL;
OstreeObjectType objtype; OstreeObjectType objtype;
@ -370,7 +370,7 @@ ostree_repo_resolve_rev (OstreeRepo *self,
GError **error) GError **error)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_free char *ret_rev = NULL; g_autofree char *ret_rev = NULL;
g_return_val_if_fail (refspec != NULL, FALSE); g_return_val_if_fail (refspec != NULL, FALSE);
@ -389,8 +389,8 @@ ostree_repo_resolve_rev (OstreeRepo *self,
if (g_str_has_suffix (refspec, "^")) if (g_str_has_suffix (refspec, "^"))
{ {
gs_free char *parent_refspec = NULL; g_autofree char *parent_refspec = NULL;
gs_free char *parent_rev = NULL; g_autofree char *parent_rev = NULL;
gs_unref_variant GVariant *commit = NULL; gs_unref_variant GVariant *commit = NULL;
parent_refspec = g_strdup (refspec); parent_refspec = g_strdup (refspec);
@ -412,8 +412,8 @@ ostree_repo_resolve_rev (OstreeRepo *self,
} }
else else
{ {
gs_free char *remote = NULL; g_autofree char *remote = NULL;
gs_free char *ref = NULL; g_autofree char *ref = NULL;
if (!ostree_parse_refspec (refspec, &remote, &ref, error)) if (!ostree_parse_refspec (refspec, &remote, &ref, error))
goto out; goto out;
@ -498,8 +498,8 @@ ostree_repo_list_refs (OstreeRepo *self,
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_unref_hashtable GHashTable *ret_all_refs = NULL; gs_unref_hashtable GHashTable *ret_all_refs = NULL;
gs_free char *remote = NULL; g_autofree char *remote = NULL;
gs_free char *ref_prefix = NULL; g_autofree char *ref_prefix = NULL;
ret_all_refs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); ret_all_refs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
@ -651,8 +651,8 @@ _ostree_repo_update_refs (OstreeRepo *self,
{ {
const char *refspec = key; const char *refspec = key;
const char *rev = value; const char *rev = value;
gs_free char *remote = NULL; g_autofree char *remote = NULL;
gs_free char *ref = NULL; g_autofree char *ref = NULL;
if (!ostree_parse_refspec (refspec, &remote, &ref, error)) if (!ostree_parse_refspec (refspec, &remote, &ref, error))
goto out; goto out;

View File

@ -453,7 +453,7 @@ get_unpacked_unlinked_content (OstreeRepo *repo,
GError **error) GError **error)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_free char *tmpname = g_strdup ("tmpostree-deltaobj-XXXXXX"); g_autofree char *tmpname = g_strdup ("tmpostree-deltaobj-XXXXXX");
gs_fd_close int fd = -1; gs_fd_close int fd = -1;
gs_unref_bytes GBytes *ret_content = NULL; gs_unref_bytes GBytes *ret_content = NULL;
gs_unref_object GInputStream *istream = NULL; gs_unref_object GInputStream *istream = NULL;
@ -1094,7 +1094,7 @@ generate_delta_lowlatency (OstreeRepo *repo,
if (fallback) if (fallback)
{ {
gs_free char *size = g_format_size (uncompressed_size); g_autofree char *size = g_format_size (uncompressed_size);
if (opts & DELTAOPT_FLAG_VERBOSE) if (opts & DELTAOPT_FLAG_VERBOSE)
g_printerr ("fallback for %s (%s)\n", checksum, size); g_printerr ("fallback for %s (%s)\n", checksum, size);
@ -1252,7 +1252,7 @@ ostree_repo_static_delta_generate (OstreeRepo *self,
gs_unref_ptrarray GPtrArray *part_tempfiles = NULL; gs_unref_ptrarray GPtrArray *part_tempfiles = NULL;
gs_unref_variant GVariant *delta_descriptor = NULL; gs_unref_variant GVariant *delta_descriptor = NULL;
gs_unref_variant GVariant *to_commit = NULL; gs_unref_variant GVariant *to_commit = NULL;
gs_free char *descriptor_relpath = NULL; g_autofree char *descriptor_relpath = NULL;
gs_unref_object GFile *descriptor_path = NULL; gs_unref_object GFile *descriptor_path = NULL;
gs_unref_object GFile *descriptor_dir = NULL; gs_unref_object GFile *descriptor_dir = NULL;
gs_unref_variant GVariant *tmp_metadata = NULL; gs_unref_variant GVariant *tmp_metadata = NULL;
@ -1299,7 +1299,7 @@ ostree_repo_static_delta_generate (OstreeRepo *self,
OstreeStaticDeltaPartBuilder *part_builder = builder.parts->pdata[i]; OstreeStaticDeltaPartBuilder *part_builder = builder.parts->pdata[i];
GBytes *payload_b; GBytes *payload_b;
GBytes *operations_b; GBytes *operations_b;
gs_free guchar *part_checksum = NULL; g_autofree guchar *part_checksum = NULL;
gs_free_checksum GChecksum *checksum = NULL; gs_free_checksum GChecksum *checksum = NULL;
gs_unref_bytes GBytes *objtype_checksum_array = NULL; gs_unref_bytes GBytes *objtype_checksum_array = NULL;
gs_unref_bytes GBytes *checksum_bytes = NULL; gs_unref_bytes GBytes *checksum_bytes = NULL;
@ -1400,7 +1400,7 @@ ostree_repo_static_delta_generate (OstreeRepo *self,
for (i = 0; i < builder.parts->len; i++) for (i = 0; i < builder.parts->len; i++)
{ {
GFile *tempfile = part_tempfiles->pdata[i]; GFile *tempfile = part_tempfiles->pdata[i];
gs_free char *part_relpath = _ostree_get_relative_static_delta_part_path (from, to, i); g_autofree char *part_relpath = _ostree_get_relative_static_delta_part_path (from, to, i);
gs_unref_object GFile *part_path = g_file_resolve_relative_path (self->repodir, part_relpath); gs_unref_object GFile *part_path = g_file_resolve_relative_path (self->repodir, part_relpath);
if (!gs_file_rename (tempfile, part_path, cancellable, error)) if (!gs_file_rename (tempfile, part_path, cancellable, error))

View File

@ -127,7 +127,7 @@ ostree_repo_list_static_delta_names (OstreeRepo *self,
if (g_file_query_exists (meta_path, NULL)) if (g_file_query_exists (meta_path, NULL))
{ {
gs_free char *buf = g_strconcat (name1, name2, NULL); g_autofree char *buf = g_strconcat (name1, name2, NULL);
GString *out = g_string_new (""); GString *out = g_string_new ("");
char checksum[65]; char checksum[65];
guchar csum[32]; guchar csum[32];
@ -238,7 +238,7 @@ ostree_repo_static_delta_execute_offline (OstreeRepo *self,
/* Write the to-commit object */ /* Write the to-commit object */
{ {
gs_unref_variant GVariant *to_csum_v = NULL; gs_unref_variant GVariant *to_csum_v = NULL;
gs_free char *to_checksum = NULL; g_autofree char *to_checksum = NULL;
gs_unref_variant GVariant *to_commit = NULL; gs_unref_variant GVariant *to_commit = NULL;
gboolean have_to_commit; gboolean have_to_commit;
@ -309,7 +309,7 @@ ostree_repo_static_delta_execute_offline (OstreeRepo *self,
if (!skip_validation) if (!skip_validation)
{ {
gs_free char *expected_checksum = ostree_checksum_from_bytes (csum); g_autofree char *expected_checksum = ostree_checksum_from_bytes (csum);
if (!_ostree_static_delta_part_validate (self, part_path, i, if (!_ostree_static_delta_part_validate (self, part_path, i,
expected_checksum, expected_checksum,
cancellable, error)) cancellable, error))

View File

@ -158,8 +158,8 @@ _ostree_static_delta_part_validate (OstreeRepo *repo,
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_unref_object GInputStream *tmp_in = NULL; gs_unref_object GInputStream *tmp_in = NULL;
gs_free guchar *actual_checksum_bytes = NULL; g_autofree guchar *actual_checksum_bytes = NULL;
gs_free gchar *actual_checksum = NULL; g_autofree char *actual_checksum = NULL;
tmp_in = (GInputStream*)g_file_read (part_path, cancellable, error); tmp_in = (GInputStream*)g_file_read (part_path, cancellable, error);
if (!tmp_in) if (!tmp_in)
@ -525,7 +525,7 @@ dispatch_bspatch (OstreeRepo *repo,
guint64 offset, length; guint64 offset, length;
gs_unref_object GInputStream *in_stream = NULL; gs_unref_object GInputStream *in_stream = NULL;
g_autoptr(GMappedFile) input_mfile = NULL; g_autoptr(GMappedFile) input_mfile = NULL;
gs_free guchar *buf = NULL; g_autofree guchar *buf = NULL;
struct bspatch_stream stream; struct bspatch_stream stream;
struct bzpatch_opaque_s opaque; struct bzpatch_opaque_s opaque;
gsize bytes_written; gsize bytes_written;
@ -651,7 +651,7 @@ dispatch_open_splice_and_close (OstreeRepo *repo,
if (S_ISLNK (state->mode)) if (S_ISLNK (state->mode))
{ {
gs_free char *nulterminated_target = g_autofree char *nulterminated_target =
g_strndup ((char*)state->payload_data + content_offset, state->content_size); g_strndup ((char*)state->payload_data + content_offset, state->content_size);
g_file_info_set_symlink_target (finfo, nulterminated_target); g_file_info_set_symlink_target (finfo, nulterminated_target);
} }

View File

@ -417,7 +417,7 @@ ostree_repo_traverse_commit_union (OstreeRepo *repo,
GError **error) GError **error)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_free char *tmp_checksum = NULL; g_autofree char *tmp_checksum = NULL;
while (TRUE) while (TRUE)
{ {

View File

@ -670,7 +670,7 @@ ostree_repo_write_config (OstreeRepo *self,
GError **error) GError **error)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_free char *data = NULL; g_autofree char *data = NULL;
gsize len; gsize len;
g_return_val_if_fail (self->inited, FALSE); g_return_val_if_fail (self->inited, FALSE);
@ -774,7 +774,7 @@ impl_repo_remote_add (OstreeRepo *self,
if (sysroot != NULL || ostree_repo_is_system (self)) if (sysroot != NULL || ostree_repo_is_system (self))
{ {
const char *sysconf_remotes = SYSCONFDIR "/ostree/remotes.d"; const char *sysconf_remotes = SYSCONFDIR "/ostree/remotes.d";
gs_free char *basename = g_strconcat (name, ".conf", NULL); g_autofree char *basename = g_strconcat (name, ".conf", NULL);
gs_unref_object GFile *etc_ostree_remotes_d = NULL; gs_unref_object GFile *etc_ostree_remotes_d = NULL;
if (sysroot == NULL) if (sysroot == NULL)
@ -795,7 +795,7 @@ impl_repo_remote_add (OstreeRepo *self,
if (remote->file != NULL) if (remote->file != NULL)
{ {
gs_free char *data = NULL; g_autofree char *data = NULL;
gsize length; gsize length;
data = g_key_file_to_data (remote->options, &length, NULL); data = g_key_file_to_data (remote->options, &length, NULL);
@ -1051,7 +1051,7 @@ ostree_repo_remote_get_url (OstreeRepo *self,
GError **error) GError **error)
{ {
local_cleanup_remote OstreeRemote *remote = NULL; local_cleanup_remote OstreeRemote *remote = NULL;
gs_free char *url = NULL; g_autofree char *url = NULL;
gboolean ret = FALSE; gboolean ret = FALSE;
g_return_val_if_fail (name != NULL, FALSE); g_return_val_if_fail (name != NULL, FALSE);
@ -1395,9 +1395,9 @@ ostree_repo_open (OstreeRepo *self,
gboolean ret = FALSE; gboolean ret = FALSE;
gboolean is_archive; gboolean is_archive;
struct stat stbuf; struct stat stbuf;
gs_free char *version = NULL; g_autofree char *version = NULL;
gs_free char *mode = NULL; g_autofree char *mode = NULL;
gs_free char *parent_repo_path = NULL; g_autofree char *parent_repo_path = NULL;
g_return_val_if_fail (error == NULL || *error == NULL, FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
@ -2828,7 +2828,7 @@ ostree_repo_read_commit (OstreeRepo *self,
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_unref_object GFile *ret_root = NULL; gs_unref_object GFile *ret_root = NULL;
gs_free char *resolved_commit = NULL; g_autofree char *resolved_commit = NULL;
if (!ostree_repo_resolve_rev (self, ref, FALSE, &resolved_commit, error)) if (!ostree_repo_resolve_rev (self, ref, FALSE, &resolved_commit, error))
goto out; goto out;
@ -2967,7 +2967,7 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress
{ {
GSConsole *console = user_data; GSConsole *console = user_data;
GString *buf; GString *buf;
gs_free char *status = NULL; g_autofree char *status = NULL;
guint outstanding_fetches; guint outstanding_fetches;
guint outstanding_metadata_fetches; guint outstanding_metadata_fetches;
guint outstanding_writes; guint outstanding_writes;
@ -2999,9 +2999,9 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress
guint metadata_fetched = ostree_async_progress_get_uint (progress, "metadata-fetched"); guint metadata_fetched = ostree_async_progress_get_uint (progress, "metadata-fetched");
guint requested = ostree_async_progress_get_uint (progress, "requested"); guint requested = ostree_async_progress_get_uint (progress, "requested");
guint64 bytes_sec = (g_get_monotonic_time () - ostree_async_progress_get_uint64 (progress, "start-time")) / G_USEC_PER_SEC; guint64 bytes_sec = (g_get_monotonic_time () - ostree_async_progress_get_uint64 (progress, "start-time")) / G_USEC_PER_SEC;
gs_free char *formatted_bytes_transferred = g_autofree char *formatted_bytes_transferred =
g_format_size_full (bytes_transferred, 0); g_format_size_full (bytes_transferred, 0);
gs_free char *formatted_bytes_sec = NULL; g_autofree char *formatted_bytes_sec = NULL;
if (!bytes_sec) // Ignore first second if (!bytes_sec) // Ignore first second
formatted_bytes_sec = g_strdup ("-"); formatted_bytes_sec = g_strdup ("-");
@ -3014,7 +3014,7 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress
if (total_delta_parts > 0) if (total_delta_parts > 0)
{ {
guint64 total_delta_part_size = ostree_async_progress_get_uint64 (progress, "total-delta-part-size"); guint64 total_delta_part_size = ostree_async_progress_get_uint64 (progress, "total-delta-part-size");
gs_free char *formatted_total = g_autofree char *formatted_total =
g_format_size (total_delta_part_size); g_format_size (total_delta_part_size);
g_string_append_printf (buf, "Receiving delta parts: %u/%u %s/s %s/%s", g_string_append_printf (buf, "Receiving delta parts: %u/%u %s/s %s/%s",
fetched_delta_parts, total_delta_parts, fetched_delta_parts, total_delta_parts,
@ -3345,9 +3345,9 @@ ostree_repo_sign_delta (OstreeRepo *self,
gs_unref_bytes GBytes *delta_data = NULL; gs_unref_bytes GBytes *delta_data = NULL;
gs_unref_bytes GBytes *signature_data = NULL; gs_unref_bytes GBytes *signature_data = NULL;
gs_unref_variant GVariant *commit_variant = NULL; gs_unref_variant GVariant *commit_variant = NULL;
gs_free char *delta_path = NULL; g_autofree char *delta_path = NULL;
gs_unref_object GFile *delta_file = NULL; gs_unref_object GFile *delta_file = NULL;
gs_free char *detached_metadata_relpath = NULL; g_autofree char *detached_metadata_relpath = NULL;
gs_unref_object GFile *detached_metadata_path = NULL; gs_unref_object GFile *detached_metadata_path = NULL;
gs_unref_variant GVariant *existing_detached_metadata = NULL; gs_unref_variant GVariant *existing_detached_metadata = NULL;
gs_unref_variant GVariant *normalized = NULL; gs_unref_variant GVariant *normalized = NULL;
@ -3538,7 +3538,7 @@ ostree_repo_verify_commit_ext (OstreeRepo *self,
gs_unref_object GFile *keyringdir_ref = NULL; gs_unref_object GFile *keyringdir_ref = NULL;
gs_unref_variant GVariant *metadata = NULL; gs_unref_variant GVariant *metadata = NULL;
gs_unref_bytes GBytes *signed_data = NULL; gs_unref_bytes GBytes *signed_data = NULL;
gs_free gchar *commit_filename = NULL; g_autofree char *commit_filename = NULL;
/* Create a temporary file for the commit */ /* Create a temporary file for the commit */
if (!ostree_repo_load_variant (self, OSTREE_OBJECT_TYPE_COMMIT, if (!ostree_repo_load_variant (self, OSTREE_OBJECT_TYPE_COMMIT,

View File

@ -194,7 +194,7 @@ initable_init (GInitable *initable,
{ {
gsize len; gsize len;
GError *temp_error = NULL; GError *temp_error = NULL;
gs_free char *line = g_data_input_stream_read_line_utf8 (datain, &len, g_autofree char *line = g_data_input_stream_read_line_utf8 (datain, &len,
cancellable, &temp_error); cancellable, &temp_error);
if (temp_error) if (temp_error)
@ -397,7 +397,7 @@ ostree_sepolicy_restorecon (OstreeSePolicy *self,
#ifdef HAVE_SELINUX #ifdef HAVE_SELINUX
gboolean ret = FALSE; gboolean ret = FALSE;
gs_unref_object GFileInfo *src_info = NULL; gs_unref_object GFileInfo *src_info = NULL;
gs_free char *label = NULL; g_autofree char *label = NULL;
gboolean do_relabel = TRUE; gboolean do_relabel = TRUE;
if (info != NULL) if (info != NULL)
@ -475,7 +475,7 @@ ostree_sepolicy_setfscreatecon (OstreeSePolicy *self,
{ {
#ifdef HAVE_SELINUX #ifdef HAVE_SELINUX
gboolean ret = FALSE; gboolean ret = FALSE;
gs_free char *label = NULL; g_autofree char *label = NULL;
/* setfscreatecon() will bomb out if the host has SELinux disabled, /* setfscreatecon() will bomb out if the host has SELinux disabled,
* but we're enabled for the target system. This is kind of a * but we're enabled for the target system. This is kind of a

View File

@ -63,7 +63,7 @@ _ostree_sysroot_list_deployment_dirs_for_os (GFile *osdir,
GFileInfo *file_info = NULL; GFileInfo *file_info = NULL;
GFile *child = NULL; GFile *child = NULL;
gs_unref_object OstreeDeployment *deployment = NULL; gs_unref_object OstreeDeployment *deployment = NULL;
gs_free char *csum = NULL; g_autofree char *csum = NULL;
gint deployserial; gint deployserial;
if (!gs_file_enumerator_iterate (dir_enum, &file_info, &child, if (!gs_file_enumerator_iterate (dir_enum, &file_info, &child,
@ -368,8 +368,8 @@ cleanup_old_deployments (OstreeSysroot *self,
for (i = 0; i < all_boot_dirs->len; i++) for (i = 0; i < all_boot_dirs->len; i++)
{ {
GFile *bootdir = all_boot_dirs->pdata[i]; GFile *bootdir = all_boot_dirs->pdata[i];
gs_free char *osname = NULL; g_autofree char *osname = NULL;
gs_free char *bootcsum = NULL; g_autofree char *bootcsum = NULL;
if (!parse_bootdir_name (gs_file_get_basename_cached (bootdir), if (!parse_bootdir_name (gs_file_get_basename_cached (bootdir),
&osname, &bootcsum)) &osname, &bootcsum))
@ -395,7 +395,7 @@ cleanup_ref_prefix (OstreeRepo *repo,
GError **error) GError **error)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_free char *prefix = NULL; g_autofree char *prefix = NULL;
gs_unref_hashtable GHashTable *refs = NULL; gs_unref_hashtable GHashTable *refs = NULL;
GHashTableIter hashiter; GHashTableIter hashiter;
gpointer hashkey, hashvalue; gpointer hashkey, hashvalue;
@ -412,7 +412,7 @@ cleanup_ref_prefix (OstreeRepo *repo,
while (g_hash_table_iter_next (&hashiter, &hashkey, &hashvalue)) while (g_hash_table_iter_next (&hashiter, &hashkey, &hashvalue))
{ {
const char *suffix = hashkey; const char *suffix = hashkey;
gs_free char *ref = g_strconcat (prefix, "/", suffix, NULL); g_autofree char *ref = g_strconcat (prefix, "/", suffix, NULL);
ostree_repo_transaction_set_refspec (repo, ref, NULL); ostree_repo_transaction_set_refspec (repo, ref, NULL);
} }
@ -459,7 +459,7 @@ generate_deployment_refs_and_prune (OstreeSysroot *self,
for (i = 0; i < deployments->len; i++) for (i = 0; i < deployments->len; i++)
{ {
OstreeDeployment *deployment = deployments->pdata[i]; OstreeDeployment *deployment = deployments->pdata[i];
gs_free char *refname = g_strdup_printf ("ostree/%d/%d/%u", g_autofree char *refname = g_strdup_printf ("ostree/%d/%d/%u",
bootversion, subbootversion, bootversion, subbootversion,
i); i);

View File

@ -190,7 +190,7 @@ ensure_directory_from_template (int orig_etc_fd,
} }
else if (errno == ENOENT) else if (errno == ENOENT)
{ {
gs_free char *parent_path = g_path_get_dirname (path); g_autofree char *parent_path = g_path_get_dirname (path);
if (strcmp (parent_path, ".") != 0) if (strcmp (parent_path, ".") != 0)
{ {
@ -266,7 +266,7 @@ copy_modified_config_file (int orig_etc_fd,
if (strchr (path, '/') != NULL) if (strchr (path, '/') != NULL)
{ {
gs_free char *parent = g_path_get_dirname (path); g_autofree char *parent = g_path_get_dirname (path);
if (!ensure_directory_from_template (orig_etc_fd, modified_etc_fd, new_etc_fd, if (!ensure_directory_from_template (orig_etc_fd, modified_etc_fd, new_etc_fd,
parent, &dest_parent_dfd, cancellable, error)) parent, &dest_parent_dfd, cancellable, error))
@ -414,7 +414,7 @@ merge_etc_changes (GFile *orig_etc,
{ {
GFile *file = removed->pdata[i]; GFile *file = removed->pdata[i];
gs_unref_object GFile *target_file = NULL; gs_unref_object GFile *target_file = NULL;
gs_free char *path = NULL; g_autofree char *path = NULL;
path = g_file_get_relative_path (orig_etc, file); path = g_file_get_relative_path (orig_etc, file);
g_assert (path); g_assert (path);
@ -427,7 +427,7 @@ merge_etc_changes (GFile *orig_etc,
for (i = 0; i < modified->len; i++) for (i = 0; i < modified->len; i++)
{ {
OstreeDiffItem *diff = modified->pdata[i]; OstreeDiffItem *diff = modified->pdata[i];
gs_free char *path = g_file_get_relative_path (modified_etc, diff->target); g_autofree char *path = g_file_get_relative_path (modified_etc, diff->target);
g_assert (path); g_assert (path);
@ -438,7 +438,7 @@ merge_etc_changes (GFile *orig_etc,
for (i = 0; i < added->len; i++) for (i = 0; i < added->len; i++)
{ {
GFile *file = added->pdata[i]; GFile *file = added->pdata[i];
gs_free char *path = g_file_get_relative_path (modified_etc, file); g_autofree char *path = g_file_get_relative_path (modified_etc, file);
g_assert (path); g_assert (path);
@ -475,7 +475,7 @@ checkout_deployment_tree (OstreeSysroot *sysroot,
gboolean ret = FALSE; gboolean ret = FALSE;
OstreeRepoCheckoutOptions checkout_opts = { 0, }; OstreeRepoCheckoutOptions checkout_opts = { 0, };
const char *csum = ostree_deployment_get_csum (deployment); const char *csum = ostree_deployment_get_csum (deployment);
gs_free char *checkout_target_name = NULL; g_autofree char *checkout_target_name = NULL;
g_autofree char *osdeploy_path = NULL; g_autofree char *osdeploy_path = NULL;
gs_unref_object GFile *ret_deploy_target_path = NULL; gs_unref_object GFile *ret_deploy_target_path = NULL;
glnx_fd_close int osdeploy_dfd = -1; glnx_fd_close int osdeploy_dfd = -1;
@ -538,7 +538,7 @@ relabel_one_path (OstreeSysroot *sysroot,
GError **error) GError **error)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_free char *relpath = NULL; g_autofree char *relpath = NULL;
relpath = ptrarray_path_join (path_parts); relpath = ptrarray_path_join (path_parts);
if (!ostree_sepolicy_restorecon (sepolicy, relpath, if (!ostree_sepolicy_restorecon (sepolicy, relpath,
@ -851,7 +851,7 @@ ostree_sysroot_write_origin_file (OstreeSysroot *sysroot,
gs_unref_object GFile *deployment_path = ostree_sysroot_get_deployment_directory (sysroot, deployment); gs_unref_object GFile *deployment_path = ostree_sysroot_get_deployment_directory (sysroot, deployment);
gs_unref_object GFile *origin_path = ostree_sysroot_get_deployment_origin_path (deployment_path); gs_unref_object GFile *origin_path = ostree_sysroot_get_deployment_origin_path (deployment_path);
gs_unref_object GFile *origin_parent = g_file_get_parent (origin_path); gs_unref_object GFile *origin_parent = g_file_get_parent (origin_path);
gs_free char *contents = NULL; g_autofree char *contents = NULL;
gsize len; gsize len;
gs_unref_bytes GBytes *contents_bytes = NULL; gs_unref_bytes GBytes *contents_bytes = NULL;
@ -887,8 +887,8 @@ get_kernel_from_tree (GFile *deployroot,
gs_unref_object GFileEnumerator *dir_enum = NULL; gs_unref_object GFileEnumerator *dir_enum = NULL;
gs_unref_object GFile *ret_kernel = NULL; gs_unref_object GFile *ret_kernel = NULL;
gs_unref_object GFile *ret_initramfs = NULL; gs_unref_object GFile *ret_initramfs = NULL;
gs_free char *kernel_checksum = NULL; g_autofree char *kernel_checksum = NULL;
gs_free char *initramfs_checksum = NULL; g_autofree char *initramfs_checksum = NULL;
if (g_file_query_exists (ostree_bootdir, NULL)) if (g_file_query_exists (ostree_bootdir, NULL))
{ {
@ -1055,9 +1055,9 @@ swap_bootlinks (OstreeSysroot *self,
int old_subbootversion; int old_subbootversion;
int new_subbootversion; int new_subbootversion;
gs_unref_object GFile *ostree_dir = g_file_get_child (self->path, "ostree"); gs_unref_object GFile *ostree_dir = g_file_get_child (self->path, "ostree");
gs_free char *ostree_bootdir_name = g_strdup_printf ("boot.%d", bootversion); g_autofree char *ostree_bootdir_name = g_strdup_printf ("boot.%d", bootversion);
gs_unref_object GFile *ostree_bootdir = g_file_resolve_relative_path (ostree_dir, ostree_bootdir_name); gs_unref_object GFile *ostree_bootdir = g_file_resolve_relative_path (ostree_dir, ostree_bootdir_name);
gs_free char *ostree_subbootdir_name = NULL; g_autofree char *ostree_subbootdir_name = NULL;
gs_unref_object GFile *ostree_subbootdir = NULL; gs_unref_object GFile *ostree_subbootdir = NULL;
if (bootversion != self->bootversion) if (bootversion != self->bootversion)
@ -1083,11 +1083,11 @@ swap_bootlinks (OstreeSysroot *self,
for (i = 0; i < new_deployments->len; i++) for (i = 0; i < new_deployments->len; i++)
{ {
OstreeDeployment *deployment = new_deployments->pdata[i]; OstreeDeployment *deployment = new_deployments->pdata[i];
gs_free char *bootlink_pathname = g_strdup_printf ("%s/%s/%d", g_autofree char *bootlink_pathname = g_strdup_printf ("%s/%s/%d",
ostree_deployment_get_osname (deployment), ostree_deployment_get_osname (deployment),
ostree_deployment_get_bootcsum (deployment), ostree_deployment_get_bootcsum (deployment),
ostree_deployment_get_bootserial (deployment)); ostree_deployment_get_bootserial (deployment));
gs_free char *bootlink_target = g_strdup_printf ("../../../deploy/%s/deploy/%s.%d", g_autofree char *bootlink_target = g_strdup_printf ("../../../deploy/%s/deploy/%s.%d",
ostree_deployment_get_osname (deployment), ostree_deployment_get_osname (deployment),
ostree_deployment_get_csum (deployment), ostree_deployment_get_csum (deployment),
ostree_deployment_get_deployserial (deployment)); ostree_deployment_get_deployserial (deployment));
@ -1177,23 +1177,23 @@ install_deployment_kernel (OstreeSysroot *sysroot,
gs_unref_object GFile *bootcsumdir = NULL; gs_unref_object GFile *bootcsumdir = NULL;
gs_unref_object GFile *bootconfpath = NULL; gs_unref_object GFile *bootconfpath = NULL;
gs_unref_object GFile *bootconfpath_parent = NULL; gs_unref_object GFile *bootconfpath_parent = NULL;
gs_free char *dest_kernel_name = NULL; g_autofree char *dest_kernel_name = NULL;
gs_unref_object GFile *dest_kernel_path = NULL; gs_unref_object GFile *dest_kernel_path = NULL;
gs_unref_object GFile *dest_initramfs_path = NULL; gs_unref_object GFile *dest_initramfs_path = NULL;
gs_unref_object GFile *tree_kernel_path = NULL; gs_unref_object GFile *tree_kernel_path = NULL;
gs_unref_object GFile *tree_initramfs_path = NULL; gs_unref_object GFile *tree_initramfs_path = NULL;
gs_unref_object GFile *deployment_dir = NULL; gs_unref_object GFile *deployment_dir = NULL;
glnx_fd_close int deployment_dfd = -1; glnx_fd_close int deployment_dfd = -1;
gs_free char *contents = NULL; g_autofree char *contents = NULL;
gs_free char *deployment_version = NULL; g_autofree char *deployment_version = NULL;
gs_unref_hashtable GHashTable *osrelease_values = NULL; gs_unref_hashtable GHashTable *osrelease_values = NULL;
gs_free char *linux_relpath = NULL; g_autofree char *linux_relpath = NULL;
gs_free char *linux_key = NULL; g_autofree char *linux_key = NULL;
gs_free char *initramfs_relpath = NULL; g_autofree char *initramfs_relpath = NULL;
gs_free char *initrd_key = NULL; g_autofree char *initrd_key = NULL;
gs_free char *version_key = NULL; g_autofree char *version_key = NULL;
gs_free char *ostree_kernel_arg = NULL; g_autofree char *ostree_kernel_arg = NULL;
gs_free char *options_key = NULL; g_autofree char *options_key = NULL;
GString *title_key; GString *title_key;
__attribute__((cleanup(_ostree_kernel_args_cleanup))) OstreeKernelArgs *kargs = NULL; __attribute__((cleanup(_ostree_kernel_args_cleanup))) OstreeKernelArgs *kargs = NULL;
const char *val; const char *val;
@ -1236,7 +1236,7 @@ install_deployment_kernel (OstreeSysroot *sysroot,
if (tree_initramfs_path) if (tree_initramfs_path)
{ {
gs_free char *dest_initramfs_name = remove_checksum_from_kernel_name (gs_file_get_basename_cached (tree_initramfs_path), g_autofree char *dest_initramfs_name = remove_checksum_from_kernel_name (gs_file_get_basename_cached (tree_initramfs_path),
bootcsum); bootcsum);
dest_initramfs_path = g_file_get_child (bootcsumdir, dest_initramfs_name); dest_initramfs_path = g_file_get_child (bootcsumdir, dest_initramfs_name);
@ -1381,7 +1381,7 @@ swap_bootloader (OstreeSysroot *sysroot,
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_unref_object GFile *boot_loader_link = NULL; gs_unref_object GFile *boot_loader_link = NULL;
gs_free char *new_target = NULL; g_autofree char *new_target = NULL;
g_assert ((current_bootversion == 0 && new_bootversion == 1) || g_assert ((current_bootversion == 0 && new_bootversion == 1) ||
(current_bootversion == 1 && new_bootversion == 0)); (current_bootversion == 1 && new_bootversion == 0));
@ -1437,8 +1437,8 @@ deployment_bootconfigs_equal (OstreeDeployment *a,
const char *b_boot_options = ostree_bootconfig_parser_get (b_bootconfig, "options"); const char *b_boot_options = ostree_bootconfig_parser_get (b_bootconfig, "options");
__attribute__((cleanup(_ostree_kernel_args_cleanup))) OstreeKernelArgs *a_kargs = NULL; __attribute__((cleanup(_ostree_kernel_args_cleanup))) OstreeKernelArgs *a_kargs = NULL;
__attribute__((cleanup(_ostree_kernel_args_cleanup))) OstreeKernelArgs *b_kargs = NULL; __attribute__((cleanup(_ostree_kernel_args_cleanup))) OstreeKernelArgs *b_kargs = NULL;
gs_free char *a_boot_options_without_ostree = NULL; g_autofree char *a_boot_options_without_ostree = NULL;
gs_free char *b_boot_options_without_ostree = NULL; g_autofree char *b_boot_options_without_ostree = NULL;
/* We checksum the kernel arguments *except* ostree= */ /* We checksum the kernel arguments *except* ostree= */
a_kargs = _ostree_kernel_args_from_string (a_boot_options); a_kargs = _ostree_kernel_args_from_string (a_boot_options);
@ -1775,7 +1775,7 @@ ostree_sysroot_deploy_tree (OstreeSysroot *self,
gs_unref_object GFile *tree_initramfs_path = NULL; gs_unref_object GFile *tree_initramfs_path = NULL;
glnx_fd_close int deployment_dfd = -1; glnx_fd_close int deployment_dfd = -1;
gs_unref_object OstreeSePolicy *sepolicy = NULL; gs_unref_object OstreeSePolicy *sepolicy = NULL;
gs_free char *new_bootcsum = NULL; g_autofree char *new_bootcsum = NULL;
gs_unref_object OstreeBootconfigParser *bootconfig = NULL; gs_unref_object OstreeBootconfigParser *bootconfig = NULL;
g_return_val_if_fail (osname != NULL || self->booted_deployment != NULL, FALSE); g_return_val_if_fail (osname != NULL || self->booted_deployment != NULL, FALSE);
@ -1888,7 +1888,7 @@ ostree_sysroot_deploy_tree (OstreeSysroot *self,
if (override_kernel_argv) if (override_kernel_argv)
{ {
__attribute__((cleanup(_ostree_kernel_args_cleanup))) OstreeKernelArgs *kargs = NULL; __attribute__((cleanup(_ostree_kernel_args_cleanup))) OstreeKernelArgs *kargs = NULL;
gs_free char *new_options = NULL; g_autofree char *new_options = NULL;
kargs = _ostree_kernel_args_new (); kargs = _ostree_kernel_args_new ();
_ostree_kernel_args_append_argv (kargs, override_kernel_argv); _ostree_kernel_args_append_argv (kargs, override_kernel_argv);
@ -1925,7 +1925,7 @@ ostree_sysroot_deployment_set_kargs (OstreeSysroot *self,
gs_unref_ptrarray GPtrArray *new_deployments = g_ptr_array_new_with_free_func (g_object_unref); gs_unref_ptrarray GPtrArray *new_deployments = g_ptr_array_new_with_free_func (g_object_unref);
gs_unref_object OstreeDeployment *new_deployment = NULL; gs_unref_object OstreeDeployment *new_deployment = NULL;
__attribute__((cleanup(_ostree_kernel_args_cleanup))) OstreeKernelArgs *kargs = NULL; __attribute__((cleanup(_ostree_kernel_args_cleanup))) OstreeKernelArgs *kargs = NULL;
gs_free char *new_options = NULL; g_autofree char *new_options = NULL;
OstreeBootconfigParser *new_bootconfig; OstreeBootconfigParser *new_bootconfig;
new_deployment = ostree_deployment_clone (deployment); new_deployment = ostree_deployment_clone (deployment);

View File

@ -71,8 +71,8 @@ parse_refspec (OstreeSysrootUpgrader *self,
GError **error) GError **error)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_free char *origin_refspec = NULL; g_autofree char *origin_refspec = NULL;
gs_free char *unconfigured_state = NULL; g_autofree char *unconfigured_state = NULL;
if ((self->flags & OSTREE_SYSROOT_UPGRADER_FLAGS_IGNORE_UNCONFIGURED) == 0) if ((self->flags & OSTREE_SYSROOT_UPGRADER_FLAGS_IGNORE_UNCONFIGURED) == 0)
{ {
@ -423,8 +423,8 @@ ostree_sysroot_upgrader_check_timestamps (OstreeRepo *repo,
{ {
GDateTime *old_ts = g_date_time_new_from_unix_utc (ostree_commit_get_timestamp (old_commit)); GDateTime *old_ts = g_date_time_new_from_unix_utc (ostree_commit_get_timestamp (old_commit));
GDateTime *new_ts = g_date_time_new_from_unix_utc (ostree_commit_get_timestamp (new_commit)); GDateTime *new_ts = g_date_time_new_from_unix_utc (ostree_commit_get_timestamp (new_commit));
gs_free char *old_ts_str = NULL; g_autofree char *old_ts_str = NULL;
gs_free char *new_ts_str = NULL; g_autofree char *new_ts_str = NULL;
g_assert (old_ts); g_assert (old_ts);
g_assert (new_ts); g_assert (new_ts);
@ -496,8 +496,8 @@ ostree_sysroot_upgrader_pull_one_dir (OstreeSysrootUpgrader *self,
gs_unref_object OstreeRepo *repo = NULL; gs_unref_object OstreeRepo *repo = NULL;
char *refs_to_fetch[] = { self->origin_ref, NULL }; char *refs_to_fetch[] = { self->origin_ref, NULL };
const char *from_revision = NULL; const char *from_revision = NULL;
gs_free char *new_revision = NULL; g_autofree char *new_revision = NULL;
gs_free char *origin_refspec = NULL; g_autofree char *origin_refspec = NULL;
if (!ostree_sysroot_get_repo (self->sysroot, &repo, cancellable, error)) if (!ostree_sysroot_get_repo (self->sysroot, &repo, cancellable, error))
goto out; goto out;

View File

@ -282,7 +282,7 @@ _ostree_sysroot_parse_deploy_path_name (const char *name,
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
__attribute__((cleanup(match_info_cleanup))) GMatchInfo *match = NULL; __attribute__((cleanup(match_info_cleanup))) GMatchInfo *match = NULL;
gs_free char *serial_str = NULL; g_autofree char *serial_str = NULL;
static gsize regex_initialized; static gsize regex_initialized;
static GRegex *regex; static GRegex *regex;
@ -319,7 +319,7 @@ _ostree_sysroot_read_current_subbootversion (OstreeSysroot *self,
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
struct stat stbuf; struct stat stbuf;
gs_free char *ostree_bootdir_name = g_strdup_printf ("ostree/boot.%d", bootversion); g_autofree char *ostree_bootdir_name = g_strdup_printf ("ostree/boot.%d", bootversion);
if (!ensure_sysroot_fd (self, error)) if (!ensure_sysroot_fd (self, error))
goto out; goto out;
@ -336,7 +336,7 @@ _ostree_sysroot_read_current_subbootversion (OstreeSysroot *self,
} }
else else
{ {
gs_free char *current_subbootdir_name = NULL; g_autofree char *current_subbootdir_name = NULL;
current_subbootdir_name = glnx_readlinkat_malloc (self->sysroot_fd, ostree_bootdir_name, current_subbootdir_name = glnx_readlinkat_malloc (self->sysroot_fd, ostree_bootdir_name,
cancellable, error); cancellable, error);
@ -498,7 +498,7 @@ parse_origin (OstreeSysroot *self,
g_autoptr(GKeyFile) ret_origin = NULL; g_autoptr(GKeyFile) ret_origin = NULL;
g_autofree char *origin_path = g_strconcat ("../", deployment_name, ".origin", NULL); g_autofree char *origin_path = g_strconcat ("../", deployment_name, ".origin", NULL);
struct stat stbuf; struct stat stbuf;
gs_free char *origin_contents = NULL; g_autofree char *origin_contents = NULL;
ret_origin = g_key_file_new (); ret_origin = g_key_file_new ();
@ -543,8 +543,8 @@ parse_bootlink (const char *bootlink,
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
__attribute__((cleanup(match_info_cleanup))) GMatchInfo *match = NULL; __attribute__((cleanup(match_info_cleanup))) GMatchInfo *match = NULL;
gs_free char *bootversion_str = NULL; g_autofree char *bootversion_str = NULL;
gs_free char *treebootserial_str = NULL; g_autofree char *treebootserial_str = NULL;
static gsize regex_initialized; static gsize regex_initialized;
static GRegex *regex; static GRegex *regex;
@ -588,9 +588,9 @@ parse_deployment (OstreeSysroot *self,
int entry_boot_version; int entry_boot_version;
int treebootserial = -1; int treebootserial = -1;
int deployserial = -1; int deployserial = -1;
gs_free char *osname = NULL; g_autofree char *osname = NULL;
gs_free char *bootcsum = NULL; g_autofree char *bootcsum = NULL;
gs_free char *treecsum = NULL; g_autofree char *treecsum = NULL;
glnx_fd_close int deployment_dfd = -1; glnx_fd_close int deployment_dfd = -1;
const char *deploy_basename; const char *deploy_basename;
g_autofree char *treebootserial_target = NULL; g_autofree char *treebootserial_target = NULL;
@ -675,7 +675,7 @@ list_deployments_process_one_boot_entry (OstreeSysroot *self,
GError **error) GError **error)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_free char *ostree_arg = NULL; g_autofree char *ostree_arg = NULL;
gs_unref_object OstreeDeployment *deployment = NULL; gs_unref_object OstreeDeployment *deployment = NULL;
ostree_arg = get_ostree_kernel_arg_from_config (config); ostree_arg = get_ostree_kernel_arg_from_config (config);
@ -996,7 +996,7 @@ parse_kernel_commandline (OstreeKernelArgs **out_args,
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_unref_object GFile *proc_cmdline = g_file_new_for_path ("/proc/cmdline"); gs_unref_object GFile *proc_cmdline = g_file_new_for_path ("/proc/cmdline");
gs_free char *contents = NULL; g_autofree char *contents = NULL;
gsize len; gsize len;
if (!g_file_load_contents (proc_cmdline, cancellable, &contents, &len, NULL, if (!g_file_load_contents (proc_cmdline, cancellable, &contents, &len, NULL,

View File

@ -112,7 +112,7 @@ ot_gio_splice_get_checksum (GOutputStream *out,
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
GChecksum *checksum = NULL; GChecksum *checksum = NULL;
gs_free guchar *ret_csum = NULL; g_autofree guchar *ret_csum = NULL;
checksum = g_checksum_new (G_CHECKSUM_SHA256); checksum = g_checksum_new (G_CHECKSUM_SHA256);

View File

@ -61,7 +61,7 @@ ot_lgetxattrat (int dfd,
/* A workaround for the lack of lgetxattrat(), thanks to Florian Weimer: /* A workaround for the lack of lgetxattrat(), thanks to Florian Weimer:
* https://mail.gnome.org/archives/ostree-list/2014-February/msg00017.html * https://mail.gnome.org/archives/ostree-list/2014-February/msg00017.html
*/ */
gs_free char *full_path = g_strdup_printf ("/proc/self/fd/%d/%s", dfd, path); g_autofree char *full_path = g_strdup_printf ("/proc/self/fd/%d/%s", dfd, path);
GBytes *bytes = NULL; GBytes *bytes = NULL;
ssize_t bytes_read, real_size; ssize_t bytes_read, real_size;
char *buf; char *buf;
@ -103,7 +103,7 @@ ot_lsetxattrat (int dfd,
/* A workaround for the lack of lsetxattrat(), thanks to Florian Weimer: /* A workaround for the lack of lsetxattrat(), thanks to Florian Weimer:
* https://mail.gnome.org/archives/ostree-list/2014-February/msg00017.html * https://mail.gnome.org/archives/ostree-list/2014-February/msg00017.html
*/ */
gs_free char *full_path = g_strdup_printf ("/proc/self/fd/%d/%s", dfd, path); g_autofree char *full_path = g_strdup_printf ("/proc/self/fd/%d/%s", dfd, path);
int res; int res;
do do

View File

@ -56,7 +56,7 @@ ot_gfile_from_build_path (const char *first, ...)
{ {
va_list args; va_list args;
const char *arg; const char *arg;
gs_free char *path = NULL; g_autofree char *path = NULL;
gs_unref_ptrarray GPtrArray *components = NULL; gs_unref_ptrarray GPtrArray *components = NULL;
va_start (args, first); va_start (args, first);
@ -113,7 +113,7 @@ ot_gfile_get_child_build_path (GFile *parent,
{ {
va_list args; va_list args;
const char *arg; const char *arg;
gs_free char *path = NULL; g_autofree char *path = NULL;
gs_unref_ptrarray GPtrArray *components = NULL; gs_unref_ptrarray GPtrArray *components = NULL;
va_start (args, first); va_start (args, first);
@ -142,7 +142,7 @@ ot_gfile_resolve_path_printf (GFile *path,
...) ...)
{ {
va_list args; va_list args;
gs_free char *relpath = NULL; g_autofree char *relpath = NULL;
va_start (args, format); va_start (args, format);
relpath = g_strdup_vprintf (format, args); relpath = g_strdup_vprintf (format, args);
@ -252,7 +252,7 @@ ot_gfile_load_contents_utf8_allow_noent (GFile *path,
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
GError *temp_error = NULL; GError *temp_error = NULL;
gs_free char *ret_contents = NULL; g_autofree char *ret_contents = NULL;
ret_contents = gs_file_load_contents_utf8 (path, cancellable, &temp_error); ret_contents = gs_file_load_contents_utf8 (path, cancellable, &temp_error);
if (!ret_contents) if (!ret_contents)
@ -290,7 +290,7 @@ ot_file_replace_contents_at (int dfd,
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
int fd; int fd;
gs_free char *tmpname = NULL; g_autofree char *tmpname = NULL;
gs_unref_object GOutputStream *stream = NULL; gs_unref_object GOutputStream *stream = NULL;
gs_unref_object GInputStream *instream = NULL; gs_unref_object GInputStream *instream = NULL;
@ -529,7 +529,7 @@ ot_gfile_atomic_symlink_swap (GFile *path,
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_unref_object GFile *parent = g_file_get_parent (path); gs_unref_object GFile *parent = g_file_get_parent (path);
gs_free char *tmpname = g_strconcat (gs_file_get_basename_cached (path), ".tmp", NULL); g_autofree char *tmpname = g_strconcat (gs_file_get_basename_cached (path), ".tmp", NULL);
gs_unref_object GFile *tmppath = g_file_get_child (parent, tmpname); gs_unref_object GFile *tmppath = g_file_get_child (parent, tmpname);
int parent_dfd = -1; int parent_dfd = -1;

View File

@ -73,7 +73,7 @@ ot_keyfile_get_value_with_default (GKeyFile *keyfile,
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
GError *temp_error = NULL; GError *temp_error = NULL;
gs_free char *ret_value = NULL; g_autofree char *ret_value = NULL;
g_return_val_if_fail (keyfile != NULL, ret); g_return_val_if_fail (keyfile != NULL, ret);
g_return_val_if_fail (section != NULL, ret); g_return_val_if_fail (section != NULL, ret);
@ -120,7 +120,7 @@ ot_keyfile_copy_group (GKeyFile *source_keyfile,
for (ii = 0; ii < length; ii++) for (ii = 0; ii < length; ii++)
{ {
gs_free char *value = NULL; g_autofree char *value = NULL;
value = g_key_file_get_value (source_keyfile, group_name, keys[ii], NULL); value = g_key_file_get_value (source_keyfile, group_name, keys[ii], NULL);
g_key_file_set_value (target_keyfile, group_name, keys[ii], value); g_key_file_set_value (target_keyfile, group_name, keys[ii], value);

View File

@ -61,7 +61,7 @@ ot_admin_builtin_deploy (int argc, char **argv, GCancellable *cancellable, GErro
gs_unref_ptrarray GPtrArray *new_deployments = NULL; gs_unref_ptrarray GPtrArray *new_deployments = NULL;
gs_unref_object OstreeDeployment *new_deployment = NULL; gs_unref_object OstreeDeployment *new_deployment = NULL;
gs_unref_object OstreeDeployment *merge_deployment = NULL; gs_unref_object OstreeDeployment *merge_deployment = NULL;
gs_free char *revision = NULL; g_autofree char *revision = NULL;
__attribute__((cleanup(_ostree_kernel_args_cleanup))) OstreeKernelArgs *kargs = NULL; __attribute__((cleanup(_ostree_kernel_args_cleanup))) OstreeKernelArgs *kargs = NULL;
context = g_option_context_new ("REFSPEC - Checkout revision REFSPEC as the new default deployment"); context = g_option_context_new ("REFSPEC - Checkout revision REFSPEC as the new default deployment");

View File

@ -74,7 +74,7 @@ ot_admin_builtin_instutil (int argc, char **argv, GCancellable *cancellable, GEr
gboolean ret = FALSE; gboolean ret = FALSE;
OstreeAdminInstUtilCommand *subcommand; OstreeAdminInstUtilCommand *subcommand;
const char *subcommand_name = NULL; const char *subcommand_name = NULL;
gs_free char *prgname = NULL; g_autofree char *prgname = NULL;
int in, out; int in, out;
for (in = 1, out = 1; in < argc; in++, out++) for (in = 1, out = 1; in < argc; in++, out++)
@ -111,7 +111,7 @@ ot_admin_builtin_instutil (int argc, char **argv, GCancellable *cancellable, GEr
if (!subcommand->name) if (!subcommand->name)
{ {
GOptionContext *context; GOptionContext *context;
gs_free char *help; g_autofree char *help;
context = ostree_admin_instutil_option_context_new_with_commands (); context = ostree_admin_instutil_option_context_new_with_commands ();

View File

@ -101,8 +101,8 @@ ot_admin_builtin_set_origin (int argc, char **argv, GCancellable *cancellable, G
for (iter = opt_set; iter && *iter; iter++) for (iter = opt_set; iter && *iter; iter++)
{ {
const char *keyvalue = *iter; const char *keyvalue = *iter;
gs_free char *subkey = NULL; g_autofree char *subkey = NULL;
gs_free char *subvalue = NULL; g_autofree char *subvalue = NULL;
if (!ot_parse_keyvalue (keyvalue, &subkey, &subvalue, error)) if (!ot_parse_keyvalue (keyvalue, &subkey, &subvalue, error))
goto out; goto out;
@ -120,15 +120,15 @@ ot_admin_builtin_set_origin (int argc, char **argv, GCancellable *cancellable, G
} }
{ GKeyFile *old_origin = ostree_deployment_get_origin (target_deployment); { GKeyFile *old_origin = ostree_deployment_get_origin (target_deployment);
gs_free char *origin_refspec = g_key_file_get_string (old_origin, "origin", "refspec", NULL); g_autofree char *origin_refspec = g_key_file_get_string (old_origin, "origin", "refspec", NULL);
gs_free char *new_refspec = NULL; g_autofree char *new_refspec = NULL;
gs_free char *origin_remote = NULL; g_autofree char *origin_remote = NULL;
gs_free char *origin_ref = NULL; g_autofree char *origin_ref = NULL;
if (!ostree_parse_refspec (origin_refspec, &origin_remote, &origin_ref, error)) if (!ostree_parse_refspec (origin_refspec, &origin_remote, &origin_ref, error))
goto out; goto out;
{ gs_free char *new_refspec = g_strconcat (remotename, ":", branch ? branch : origin_ref, NULL); { g_autofree char *new_refspec = g_strconcat (remotename, ":", branch ? branch : origin_ref, NULL);
gs_unref_keyfile GKeyFile *new_origin = NULL; gs_unref_keyfile GKeyFile *new_origin = NULL;
gs_unref_object GFile *origin_path = NULL; gs_unref_object GFile *origin_path = NULL;

View File

@ -57,8 +57,8 @@ deployment_get_gpg_verify (OstreeDeployment *deployment,
* API in libostree if the OstreeRepo parameter is acceptable. */ * API in libostree if the OstreeRepo parameter is acceptable. */
GKeyFile *origin; GKeyFile *origin;
gs_free char *refspec = NULL; g_autofree char *refspec = NULL;
gs_free char *remote = NULL; g_autofree char *remote = NULL;
gboolean gpg_verify = FALSE; gboolean gpg_verify = FALSE;
origin = ostree_deployment_get_origin (deployment); origin = ostree_deployment_get_origin (deployment);
@ -119,7 +119,7 @@ ot_admin_builtin_status (int argc, char **argv, GCancellable *cancellable, GErro
OstreeDeployment *deployment = deployments->pdata[i]; OstreeDeployment *deployment = deployments->pdata[i];
GKeyFile *origin; GKeyFile *origin;
const char *ref = ostree_deployment_get_csum (deployment); const char *ref = ostree_deployment_get_csum (deployment);
gs_free gchar *version = version_of_commit (repo, ref); g_autofree char *version = version_of_commit (repo, ref);
gs_unref_object OstreeGpgVerifyResult *result = NULL; gs_unref_object OstreeGpgVerifyResult *result = NULL;
GString *output_buffer; GString *output_buffer;
guint jj, n_signatures; guint jj, n_signatures;
@ -137,7 +137,7 @@ ot_admin_builtin_status (int argc, char **argv, GCancellable *cancellable, GErro
g_print (" origin: none\n"); g_print (" origin: none\n");
else else
{ {
gs_free char *origin_refspec = g_key_file_get_string (origin, "origin", "refspec", NULL); g_autofree char *origin_refspec = g_key_file_get_string (origin, "origin", "refspec", NULL);
if (!origin_refspec) if (!origin_refspec)
g_print (" origin: <unknown origin type>\n"); g_print (" origin: <unknown origin type>\n");
else else

View File

@ -47,13 +47,13 @@ ot_admin_builtin_switch (int argc, char **argv, GCancellable *cancellable, GErro
gs_unref_object OstreeSysroot *sysroot = NULL; gs_unref_object OstreeSysroot *sysroot = NULL;
const char *new_provided_refspec = NULL; const char *new_provided_refspec = NULL;
gs_unref_object OstreeRepo *repo = NULL; gs_unref_object OstreeRepo *repo = NULL;
gs_free char *origin_refspec = NULL; g_autofree char *origin_refspec = NULL;
gs_free char *origin_remote = NULL; g_autofree char *origin_remote = NULL;
gs_free char *origin_ref = NULL; g_autofree char *origin_ref = NULL;
gs_free char *new_remote = NULL; g_autofree char *new_remote = NULL;
gs_free char *new_ref = NULL; g_autofree char *new_ref = NULL;
gs_free char *new_refspec = NULL; g_autofree char *new_refspec = NULL;
gs_free char *new_revision = NULL; g_autofree char *new_revision = NULL;
gs_unref_object GFile *deployment_path = NULL; gs_unref_object GFile *deployment_path = NULL;
gs_unref_object GFile *deployment_origin_path = NULL; gs_unref_object GFile *deployment_origin_path = NULL;
gs_unref_object OstreeDeployment *merge_deployment = NULL; gs_unref_object OstreeDeployment *merge_deployment = NULL;

View File

@ -51,10 +51,10 @@ ot_admin_builtin_upgrade (int argc, char **argv, GCancellable *cancellable, GErr
GOptionContext *context; GOptionContext *context;
gs_unref_object OstreeSysroot *sysroot = NULL; gs_unref_object OstreeSysroot *sysroot = NULL;
gs_unref_object OstreeSysrootUpgrader *upgrader = NULL; gs_unref_object OstreeSysrootUpgrader *upgrader = NULL;
gs_free char *origin_remote = NULL; g_autofree char *origin_remote = NULL;
gs_free char *origin_ref = NULL; g_autofree char *origin_ref = NULL;
gs_free char *origin_refspec = NULL; g_autofree char *origin_refspec = NULL;
gs_free char *new_revision = NULL; g_autofree char *new_revision = NULL;
gs_unref_object GFile *deployment_path = NULL; gs_unref_object GFile *deployment_path = NULL;
gs_unref_object GFile *deployment_origin_path = NULL; gs_unref_object GFile *deployment_origin_path = NULL;
gs_unref_object OstreeDeployment *merge_deployment = NULL; gs_unref_object OstreeDeployment *merge_deployment = NULL;

View File

@ -61,8 +61,8 @@ relabel_one_path (OstreeSePolicy *sepolicy,
GError **error) GError **error)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_free char *relpath = NULL; g_autofree char *relpath = NULL;
gs_free char *new_label = NULL; g_autofree char *new_label = NULL;
relpath = ptrarray_path_join (path_parts); relpath = ptrarray_path_join (path_parts);
if (!ostree_sepolicy_restorecon (sepolicy, relpath, if (!ostree_sepolicy_restorecon (sepolicy, relpath,

View File

@ -82,7 +82,7 @@ ostree_builtin_admin (int argc, char **argv, GCancellable *cancellable, GError *
gboolean ret = FALSE; gboolean ret = FALSE;
const char *subcommand_name = NULL; const char *subcommand_name = NULL;
OstreeAdminCommand *subcommand; OstreeAdminCommand *subcommand;
gs_free char *prgname = NULL; g_autofree char *prgname = NULL;
int in, out; int in, out;
/* /*
@ -125,7 +125,7 @@ ostree_builtin_admin (int argc, char **argv, GCancellable *cancellable, GError *
if (!subcommand->name) if (!subcommand->name)
{ {
GOptionContext *context; GOptionContext *context;
gs_free char *help; g_autofree char *help;
context = ostree_admin_option_context_new_with_commands (); context = ostree_admin_option_context_new_with_commands ();

View File

@ -159,9 +159,9 @@ process_many_checkouts (OstreeRepo *repo,
GError *temp_error = NULL; GError *temp_error = NULL;
gs_unref_object GInputStream *instream = NULL; gs_unref_object GInputStream *instream = NULL;
gs_unref_object GDataInputStream *datastream = NULL; gs_unref_object GDataInputStream *datastream = NULL;
gs_free char *revision = NULL; g_autofree char *revision = NULL;
gs_free char *subpath = NULL; g_autofree char *subpath = NULL;
gs_free char *resolved_commit = NULL; g_autofree char *resolved_commit = NULL;
if (opt_from_stdin) if (opt_from_stdin)
{ {
@ -229,7 +229,7 @@ ostree_builtin_checkout (int argc, char **argv, GCancellable *cancellable, GErro
gboolean ret = FALSE; gboolean ret = FALSE;
const char *commit; const char *commit;
const char *destination; const char *destination;
gs_free char *resolved_commit = NULL; g_autofree char *resolved_commit = NULL;
context = g_option_context_new ("COMMIT [DESTINATION] - Check out a commit into a filesystem tree"); context = g_option_context_new ("COMMIT [DESTINATION] - Check out a commit into a filesystem tree");

View File

@ -43,8 +43,8 @@ on_checksum_received (GObject *obj,
GAsyncResult *result, GAsyncResult *result,
gpointer user_data) gpointer user_data)
{ {
gs_free guchar *csum = NULL; g_autofree guchar *csum = NULL;
gs_free char *checksum = NULL; g_autofree char *checksum = NULL;
AsyncChecksumData *data = user_data; AsyncChecksumData *data = user_data;
if (ostree_checksum_file_async_finish ((GFile*)obj, result, &csum, data->error)) if (ostree_checksum_file_async_finish ((GFile*)obj, result, &csum, data->error))

View File

@ -97,7 +97,7 @@ parse_statoverride_file (GHashTable **out_mode_add,
char **iter = NULL; /* nofree */ char **iter = NULL; /* nofree */
gs_unref_hashtable GHashTable *ret_hash = NULL; gs_unref_hashtable GHashTable *ret_hash = NULL;
gs_unref_object GFile *path = NULL; gs_unref_object GFile *path = NULL;
gs_free char *contents = NULL; g_autofree char *contents = NULL;
char **lines = NULL; char **lines = NULL;
path = g_file_new_for_path (opt_statoverride_file); path = g_file_new_for_path (opt_statoverride_file);
@ -174,8 +174,8 @@ commit_editor (OstreeRepo *repo,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
gs_free char *input = NULL; g_autofree char *input = NULL;
gs_free char *output = NULL; g_autofree char *output = NULL;
gboolean ret = FALSE; gboolean ret = FALSE;
GString *bodybuf = NULL; GString *bodybuf = NULL;
char **lines = NULL; char **lines = NULL;
@ -264,7 +264,7 @@ parse_keyvalue_strings (char **strings,
{ {
const char *s; const char *s;
const char *eq; const char *eq;
gs_free char *key = NULL; g_autofree char *key = NULL;
s = *iter; s = *iter;
@ -296,13 +296,13 @@ ostree_builtin_commit (int argc, char **argv, GCancellable *cancellable, GError
gboolean ret = FALSE; gboolean ret = FALSE;
gboolean skip_commit = FALSE; gboolean skip_commit = FALSE;
gs_unref_object GFile *arg = NULL; gs_unref_object GFile *arg = NULL;
gs_free char *parent = NULL; g_autofree char *parent = NULL;
gs_free char *commit_checksum = NULL; g_autofree char *commit_checksum = NULL;
gs_unref_object GFile *root = NULL; gs_unref_object GFile *root = NULL;
gs_unref_variant GVariant *metadata = NULL; gs_unref_variant GVariant *metadata = NULL;
gs_unref_variant GVariant *detached_metadata = NULL; gs_unref_variant GVariant *detached_metadata = NULL;
gs_unref_object OstreeMutableTree *mtree = NULL; gs_unref_object OstreeMutableTree *mtree = NULL;
gs_free char *tree_type = NULL; g_autofree char *tree_type = NULL;
gs_unref_hashtable GHashTable *mode_adds = NULL; gs_unref_hashtable GHashTable *mode_adds = NULL;
OstreeRepoCommitModifierFlags flags = 0; OstreeRepoCommitModifierFlags flags = 0;
OstreeRepoCommitModifier *modifier = NULL; OstreeRepoCommitModifier *modifier = NULL;

View File

@ -61,8 +61,8 @@ ostree_builtin_config (int argc, char **argv, GCancellable *cancellable, GError
const char *op; const char *op;
const char *section_key; const char *section_key;
const char *value; const char *value;
gs_free char *section = NULL; g_autofree char *section = NULL;
gs_free char *key = NULL; g_autofree char *key = NULL;
GKeyFile *config = NULL; GKeyFile *config = NULL;
context = g_option_context_new ("- Change configuration settings"); context = g_option_context_new ("- Change configuration settings");
@ -102,7 +102,7 @@ ostree_builtin_config (int argc, char **argv, GCancellable *cancellable, GError
else if (!strcmp (op, "get")) else if (!strcmp (op, "get"))
{ {
GKeyFile *readonly_config = NULL; GKeyFile *readonly_config = NULL;
gs_free char *value = NULL; g_autofree char *value = NULL;
if (argc < 3) if (argc < 3)
{ {
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,

View File

@ -123,7 +123,7 @@ ostree_builtin_diff (int argc, char **argv, GCancellable *cancellable, GError **
gs_unref_object OstreeRepo *repo = NULL; gs_unref_object OstreeRepo *repo = NULL;
const char *src; const char *src;
const char *target; const char *target;
gs_free char *src_prev = NULL; g_autofree char *src_prev = NULL;
gs_unref_object GFile *srcf = NULL; gs_unref_object GFile *srcf = NULL;
gs_unref_object GFile *targetf = NULL; gs_unref_object GFile *targetf = NULL;
gs_unref_ptrarray GPtrArray *modified = NULL; gs_unref_ptrarray GPtrArray *modified = NULL;
@ -183,9 +183,9 @@ ostree_builtin_diff (int argc, char **argv, GCancellable *cancellable, GError **
gs_unref_hashtable GHashTable *reachable_a = NULL; gs_unref_hashtable GHashTable *reachable_a = NULL;
gs_unref_hashtable GHashTable *reachable_b = NULL; gs_unref_hashtable GHashTable *reachable_b = NULL;
gs_unref_hashtable GHashTable *reachable_intersection = NULL; gs_unref_hashtable GHashTable *reachable_intersection = NULL;
gs_free char *rev_a = NULL; g_autofree char *rev_a = NULL;
gs_free char *rev_b = NULL; g_autofree char *rev_b = NULL;
gs_free char *size = NULL; g_autofree char *size = NULL;
guint a_size; guint a_size;
guint b_size; guint b_size;
guint64 total_common; guint64 total_common;

View File

@ -142,8 +142,8 @@ load_and_fsck_one_object (OstreeRepo *repo,
} }
else else
{ {
gs_free guchar *computed_csum = NULL; g_autofree guchar *computed_csum = NULL;
gs_free char *tmp_checksum = NULL; g_autofree char *tmp_checksum = NULL;
if (!ostree_checksum_file_from_input (file_info, xattrs, input, if (!ostree_checksum_file_from_input (file_info, xattrs, input,
objtype, &computed_csum, objtype, &computed_csum,
@ -153,7 +153,7 @@ load_and_fsck_one_object (OstreeRepo *repo,
tmp_checksum = ostree_checksum_from_bytes (computed_csum); tmp_checksum = ostree_checksum_from_bytes (computed_csum);
if (strcmp (checksum, tmp_checksum) != 0) if (strcmp (checksum, tmp_checksum) != 0)
{ {
gs_free char *msg = g_strdup_printf ("corrupted object %s.%s; actual checksum: %s", g_autofree char *msg = g_strdup_printf ("corrupted object %s.%s; actual checksum: %s",
checksum, ostree_object_type_to_string (objtype), checksum, ostree_object_type_to_string (objtype),
tmp_checksum); tmp_checksum);
if (opt_delete) if (opt_delete)

View File

@ -39,7 +39,7 @@ static GOptionEntry options[] = {
static void static void
usage_error (GOptionContext *context, const char *message, GError **error) usage_error (GOptionContext *context, const char *message, GError **error)
{ {
gs_free char *help = g_option_context_get_help (context, TRUE, NULL); g_autofree char *help = g_option_context_get_help (context, TRUE, NULL);
g_printerr ("%s", help); g_printerr ("%s", help);
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, message); g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, message);
} }
@ -199,7 +199,7 @@ ostree_builtin_gpg_sign (int argc, char **argv, GCancellable *cancellable, GErro
{ {
GOptionContext *context; GOptionContext *context;
gs_unref_object OstreeRepo *repo = NULL; gs_unref_object OstreeRepo *repo = NULL;
gs_free char *resolved_commit = NULL; g_autofree char *resolved_commit = NULL;
const char *commit; const char *commit;
char **key_ids; char **key_ids;
int n_key_ids, ii; int n_key_ids, ii;

View File

@ -43,7 +43,7 @@ log_commit (OstreeRepo *repo,
GError **error) GError **error)
{ {
gs_unref_variant GVariant *variant = NULL; gs_unref_variant GVariant *variant = NULL;
gs_free gchar *parent = NULL; g_autofree char *parent = NULL;
gboolean ret = FALSE; gboolean ret = FALSE;
GError *local_error = NULL; GError *local_error = NULL;
@ -85,7 +85,7 @@ ostree_builtin_log (int argc,
gs_unref_object OstreeRepo *repo = NULL; gs_unref_object OstreeRepo *repo = NULL;
gboolean ret = FALSE; gboolean ret = FALSE;
const char *rev; const char *rev;
gs_free char *checksum = NULL; g_autofree char *checksum = NULL;
OstreeDumpFlags flags = OSTREE_DUMP_NONE; OstreeDumpFlags flags = OSTREE_DUMP_NONE;
context = g_option_context_new ("REF - Show log starting at commit or ref"); context = g_option_context_new ("REF - Show log starting at commit or ref");

View File

@ -44,7 +44,7 @@ ostree_builtin_prune (int argc, char **argv, GCancellable *cancellable, GError *
gboolean ret = FALSE; gboolean ret = FALSE;
GOptionContext *context; GOptionContext *context;
gs_unref_object OstreeRepo *repo = NULL; gs_unref_object OstreeRepo *repo = NULL;
gs_free char *formatted_freed_size = NULL; g_autofree char *formatted_freed_size = NULL;
OstreeRepoPruneFlags pruneflags = 0; OstreeRepoPruneFlags pruneflags = 0;
gint n_objects_total; gint n_objects_total;
gint n_objects_pruned; gint n_objects_pruned;

View File

@ -48,7 +48,7 @@ ostree_builtin_pull_local (int argc, char **argv, GCancellable *cancellable, GEr
int i; int i;
const char *src_repo_arg; const char *src_repo_arg;
GSConsole *console = NULL; GSConsole *console = NULL;
gs_free char *src_repo_uri = NULL; g_autofree char *src_repo_uri = NULL;
gs_unref_object OstreeAsyncProgress *progress = NULL; gs_unref_object OstreeAsyncProgress *progress = NULL;
gs_unref_ptrarray GPtrArray *refs_to_fetch = NULL; gs_unref_ptrarray GPtrArray *refs_to_fetch = NULL;
gs_unref_hashtable GHashTable *source_objects = NULL; gs_unref_hashtable GHashTable *source_objects = NULL;
@ -77,7 +77,7 @@ ostree_builtin_pull_local (int argc, char **argv, GCancellable *cancellable, GEr
src_repo_uri = g_strconcat ("file://", src_repo_arg, NULL); src_repo_uri = g_strconcat ("file://", src_repo_arg, NULL);
else else
{ {
gs_free char *cwd = g_get_current_dir (); g_autofree char *cwd = g_get_current_dir ();
src_repo_uri = g_strconcat ("file://", cwd, "/", src_repo_arg, NULL); src_repo_uri = g_strconcat ("file://", cwd, "/", src_repo_arg, NULL);
} }

View File

@ -60,7 +60,7 @@ ostree_builtin_pull (int argc, char **argv, GCancellable *cancellable, GError **
GOptionContext *context; GOptionContext *context;
gs_unref_object OstreeRepo *repo = NULL; gs_unref_object OstreeRepo *repo = NULL;
gboolean ret = FALSE; gboolean ret = FALSE;
gs_free char *remote = NULL; g_autofree char *remote = NULL;
OstreeRepoPullFlags pullflags = 0; OstreeRepoPullFlags pullflags = 0;
GSConsole *console = NULL; GSConsole *console = NULL;
gs_unref_ptrarray GPtrArray *refs_to_fetch = NULL; gs_unref_ptrarray GPtrArray *refs_to_fetch = NULL;

View File

@ -80,8 +80,8 @@ ostree_builtin_refs (int argc, char **argv, GCancellable *cancellable, GError **
while (g_hash_table_iter_next (&hashiter, &hashkey, &hashvalue)) while (g_hash_table_iter_next (&hashiter, &hashkey, &hashvalue))
{ {
const char *refspec = hashkey; const char *refspec = hashkey;
gs_free char *remote = NULL; g_autofree char *remote = NULL;
gs_free char *ref = NULL; g_autofree char *ref = NULL;
if (!ostree_parse_refspec (refspec, &remote, &ref, error)) if (!ostree_parse_refspec (refspec, &remote, &ref, error))
goto out; goto out;

View File

@ -60,8 +60,8 @@ ostree_builtin_reset (int argc,
gboolean ret = FALSE; gboolean ret = FALSE;
const char *ref; const char *ref;
const char *target = NULL; const char *target = NULL;
gs_free gchar *current = NULL; g_autofree char *current = NULL;
gs_free gchar *checksum = NULL; g_autofree char *checksum = NULL;
context = g_option_context_new ("REF COMMIT - Reset a REF to a previous COMMIT"); context = g_option_context_new ("REF COMMIT - Reset a REF to a previous COMMIT");

View File

@ -39,7 +39,7 @@ ostree_builtin_rev_parse (int argc, char **argv, GCancellable *cancellable, GErr
gboolean ret = FALSE; gboolean ret = FALSE;
const char *rev = "master"; const char *rev = "master";
int i; int i;
gs_free char *resolved_rev = NULL; g_autofree char *resolved_rev = NULL;
context = g_option_context_new ("REV - Output the target of a rev"); context = g_option_context_new ("REV - Output the target of a rev");

View File

@ -90,7 +90,7 @@ do_print_related (OstreeRepo *repo,
while (g_variant_iter_loop (viter, "(&s@ay)", &name, &csum_v)) while (g_variant_iter_loop (viter, "(&s@ay)", &name, &csum_v))
{ {
gs_free char *checksum = ostree_checksum_from_bytes_v (csum_v); g_autofree char *checksum = ostree_checksum_from_bytes_v (csum_v);
g_print ("%s %s\n", name, checksum); g_print ("%s %s\n", name, checksum);
} }
csum_v = NULL; csum_v = NULL;
@ -249,7 +249,7 @@ ostree_builtin_show (int argc, char **argv, GCancellable *cancellable, GError **
gs_unref_object OstreeRepo *repo = NULL; gs_unref_object OstreeRepo *repo = NULL;
gboolean ret = FALSE; gboolean ret = FALSE;
const char *rev; const char *rev;
gs_free char *resolved_rev = NULL; g_autofree char *resolved_rev = NULL;
context = g_option_context_new ("OBJECT - Output a metadata object"); context = g_option_context_new ("OBJECT - Output a metadata object");
@ -341,7 +341,7 @@ ostree_builtin_show (int argc, char **argv, GCancellable *cancellable, GError **
g_print ("Extended Attributes: "); g_print ("Extended Attributes: ");
if (xattrs) if (xattrs)
{ {
gs_free char *xattr_string = g_variant_print (xattrs, TRUE); g_autofree char *xattr_string = g_variant_print (xattrs, TRUE);
g_print ("{ %s }\n", xattr_string); g_print ("{ %s }\n", xattr_string);
} }
else else

View File

@ -155,9 +155,9 @@ ot_static_delta_builtin_generate (int argc, char **argv, GCancellable *cancellab
else else
{ {
const char *from_source; const char *from_source;
gs_free char *from_resolved = NULL; g_autofree char *from_resolved = NULL;
gs_free char *to_resolved = NULL; g_autofree char *to_resolved = NULL;
gs_free char *from_parent_str = NULL; g_autofree char *from_parent_str = NULL;
gs_unref_variant_builder GVariantBuilder *parambuilder = NULL; gs_unref_variant_builder GVariantBuilder *parambuilder = NULL;
g_assert (opt_to_rev); g_assert (opt_to_rev);
@ -332,7 +332,7 @@ ostree_builtin_static_delta (int argc, char **argv, GCancellable *cancellable, G
if (!command->fn) if (!command->fn)
{ {
gs_free char *msg = g_strdup_printf ("Unknown command '%s'", cmdname); g_autofree char *msg = g_strdup_printf ("Unknown command '%s'", cmdname);
static_delta_usage (argv, TRUE); static_delta_usage (argv, TRUE);
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, msg); g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, msg);
goto out; goto out;

View File

@ -150,7 +150,7 @@ do_get (OtTrivialHttpd *self,
char *slash; char *slash;
int ret; int ret;
struct stat stbuf; struct stat stbuf;
gs_free char *safepath = NULL; g_autofree char *safepath = NULL;
if (strstr (path, "../") != NULL) if (strstr (path, "../") != NULL)
{ {
@ -188,7 +188,7 @@ do_get (OtTrivialHttpd *self,
slash = strrchr (safepath, '/'); slash = strrchr (safepath, '/');
if (!slash || slash[1]) if (!slash || slash[1])
{ {
gs_free char *redir_uri = NULL; g_autofree char *redir_uri = NULL;
redir_uri = g_strdup_printf ("%s/", soup_message_get_uri (msg)->path); redir_uri = g_strdup_printf ("%s/", soup_message_get_uri (msg)->path);
soup_message_set_redirect (msg, SOUP_STATUS_MOVED_PERMANENTLY, soup_message_set_redirect (msg, SOUP_STATUS_MOVED_PERMANENTLY,
@ -196,10 +196,10 @@ do_get (OtTrivialHttpd *self,
} }
else else
{ {
gs_free char *index_realpath = g_strconcat (safepath, "/index.html", NULL); g_autofree char *index_realpath = g_strconcat (safepath, "/index.html", NULL);
if (stat (index_realpath, &stbuf) != -1) if (stat (index_realpath, &stbuf) != -1)
{ {
gs_free char *index_path = g_strconcat (path, "/index.html", NULL); g_autofree char *index_path = g_strconcat (path, "/index.html", NULL);
do_get (self, server, msg, index_path, context); do_get (self, server, msg, index_path, context);
} }
else else
@ -276,7 +276,7 @@ do_get (OtTrivialHttpd *self,
} }
else /* msg->method == SOUP_METHOD_HEAD */ else /* msg->method == SOUP_METHOD_HEAD */
{ {
gs_free char *length = NULL; g_autofree char *length = NULL;
/* We could just use the same code for both GET and /* We could just use the same code for both GET and
* HEAD (soup-message-server-io.c will fix things up). * HEAD (soup-message-server-io.c will fix things up).
@ -360,7 +360,7 @@ ostree_builtin_trivial_httpd (int argc, char **argv, GCancellable *cancellable,
soup_server_add_handler (server, NULL, httpd_callback, app, NULL); soup_server_add_handler (server, NULL, httpd_callback, app, NULL);
if (opt_port_file) if (opt_port_file)
{ {
gs_free char *portstr = NULL; g_autofree char *portstr = NULL;
#if SOUP_CHECK_VERSION(2, 48, 0) #if SOUP_CHECK_VERSION(2, 48, 0)
GSList *listeners = soup_server_get_listeners (server); GSList *listeners = soup_server_get_listeners (server);
gs_unref_object GSocket *listener = NULL; gs_unref_object GSocket *listener = NULL;

View File

@ -31,7 +31,7 @@
void void
ot_dump_variant (GVariant *variant) ot_dump_variant (GVariant *variant)
{ {
gs_free char *formatted_variant = NULL; g_autofree char *formatted_variant = NULL;
gs_unref_variant GVariant *byteswapped = NULL; gs_unref_variant GVariant *byteswapped = NULL;
if (G_BYTE_ORDER != G_BIG_ENDIAN) if (G_BYTE_ORDER != G_BIG_ENDIAN)
@ -92,8 +92,8 @@ dump_commit (GVariant *variant,
const gchar *subject; const gchar *subject;
const gchar *body; const gchar *body;
guint64 timestamp; guint64 timestamp;
gs_free gchar *str = NULL; g_autofree char *str = NULL;
gs_free gchar *version = NULL; g_autofree char *version = NULL;
/* See OSTREE_COMMIT_GVARIANT_FORMAT */ /* See OSTREE_COMMIT_GVARIANT_FORMAT */
g_variant_get (variant, "(a{sv}aya(say)&s&stayay)", NULL, NULL, NULL, g_variant_get (variant, "(a{sv}aya(say)&s&stayay)", NULL, NULL, NULL,

View File

@ -69,7 +69,7 @@ ot_editor_prompt (OstreeRepo *repo,
GOutputStream *output; GOutputStream *output;
const char *editor; const char *editor;
char *ret = NULL; char *ret = NULL;
gs_free gchar *args = NULL; g_autofree char *args = NULL;
editor = get_editor (); editor = get_editor ();
if (editor == NULL) if (editor == NULL)
@ -89,7 +89,7 @@ ot_editor_prompt (OstreeRepo *repo,
goto out; goto out;
{ {
gs_free gchar *quoted_file = g_shell_quote (gs_file_get_path_cached (file)); g_autofree char *quoted_file = g_shell_quote (gs_file_get_path_cached (file));
args = g_strconcat (editor, " ", quoted_file, NULL); args = g_strconcat (editor, " ", quoted_file, NULL);
} }
ctx = gs_subprocess_context_newv ("/bin/sh", "-c", args, NULL); ctx = gs_subprocess_context_newv ("/bin/sh", "-c", args, NULL);

View File

@ -84,7 +84,7 @@ ostree_usage (OstreeCommand *commands,
gboolean is_error) gboolean is_error)
{ {
GOptionContext *context; GOptionContext *context;
gs_free char *help; g_autofree char *help;
context = ostree_option_context_new_with_commands (commands); context = ostree_option_context_new_with_commands (commands);
@ -125,7 +125,7 @@ ostree_run (int argc,
GError *error = NULL; GError *error = NULL;
GCancellable *cancellable = NULL; GCancellable *cancellable = NULL;
const char *command_name = NULL; const char *command_name = NULL;
gs_free char *prgname = NULL; g_autofree char *prgname = NULL;
gboolean success = FALSE; gboolean success = FALSE;
int in, out; int in, out;
@ -174,7 +174,7 @@ ostree_run (int argc,
if (!command->fn) if (!command->fn)
{ {
GOptionContext *context; GOptionContext *context;
gs_free char *help; g_autofree char *help;
context = ostree_option_context_new_with_commands (commands); context = ostree_option_context_new_with_commands (commands);
@ -265,7 +265,7 @@ ostree_option_context_parse (GOptionContext *context,
{ {
if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
{ {
gs_free char *help = NULL; g_autofree char *help = NULL;
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Command requires a --repo argument"); "Command requires a --repo argument");
@ -342,7 +342,7 @@ ostree_admin_option_context_parse (GOptionContext *context,
gs_unref_ptrarray GPtrArray *deployments = NULL; gs_unref_ptrarray GPtrArray *deployments = NULL;
OstreeDeployment *first_deployment; OstreeDeployment *first_deployment;
gs_unref_object GFile *deployment_file = NULL; gs_unref_object GFile *deployment_file = NULL;
gs_free char *deployment_path = NULL; g_autofree char *deployment_path = NULL;
if (!ostree_sysroot_load (sysroot, cancellable, error)) if (!ostree_sysroot_load (sysroot, cancellable, error))
goto out; goto out;

View File

@ -66,9 +66,9 @@ test_bsdiff (void)
struct bsdiff_stream bsdiff_stream; struct bsdiff_stream bsdiff_stream;
struct bspatch_stream bspatch_stream; struct bspatch_stream bspatch_stream;
int i; int i;
gs_free guint8 *old = g_new (guint8, OLD_SIZE); g_autofree guint8 *old = g_new (guint8, OLD_SIZE);
gs_free guint8 *new = g_new (guint8, NEW_SIZE); g_autofree guint8 *new = g_new (guint8, NEW_SIZE);
gs_free guint8 *new_generated = g_new0 (guint8, NEW_SIZE); g_autofree guint8 *new_generated = g_new0 (guint8, NEW_SIZE);
gs_unref_object GOutputStream *out = g_memory_output_stream_new_resizable (); gs_unref_object GOutputStream *out = g_memory_output_stream_new_resizable ();
gs_unref_object GInputStream *in = NULL; gs_unref_object GInputStream *in = NULL;

View File

@ -56,8 +56,8 @@ test_fixture_setup (TestFixture *fixture,
gpgme_data_t data_buffer; gpgme_data_t data_buffer;
gpgme_data_t signature_buffer; gpgme_data_t signature_buffer;
OstreeGpgVerifyResult *result; OstreeGpgVerifyResult *result;
gs_free char *homedir = NULL; g_autofree char *homedir = NULL;
gs_free char *filename = NULL; g_autofree char *filename = NULL;
GError *local_error = NULL; GError *local_error = NULL;
/* Mimic what OstreeGpgVerifier does to create OstreeGpgVerifyResult. /* Mimic what OstreeGpgVerifier does to create OstreeGpgVerifyResult.

View File

@ -181,8 +181,8 @@ test_copy_group (void)
for (ii = 0; ii < length; ii++) for (ii = 0; ii < length; ii++)
{ {
gs_free char *value = NULL; g_autofree char *value = NULL;
gs_free char *value2 = NULL; g_autofree char *value2 = NULL;
value = g_key_file_get_value (g_keyfile, section, keys[ii], NULL); value = g_key_file_get_value (g_keyfile, section, keys[ii], NULL);
value2 = g_key_file_get_value (g_keyfile, section, keys[ii], NULL); value2 = g_key_file_get_value (g_keyfile, section, keys[ii], NULL);

View File

@ -72,7 +72,7 @@ test_mutable_tree_walk (void)
{ {
gs_unref_object OstreeMutableTree *subdir = NULL; gs_unref_object OstreeMutableTree *subdir = NULL;
gs_unref_object OstreeMutableTree *a = NULL; gs_unref_object OstreeMutableTree *a = NULL;
gs_free char *source_checksum = NULL; g_autofree char *source_checksum = NULL;
ostree_mutable_tree_lookup (tree, "a", &source_checksum, &a, &error); ostree_mutable_tree_lookup (tree, "a", &source_checksum, &a, &error);
g_assert (ostree_mutable_tree_walk (a, split_path, 1, &subdir, &error)); g_assert (ostree_mutable_tree_walk (a, split_path, 1, &subdir, &error));
g_assert (subdir); g_assert (subdir);
@ -88,9 +88,9 @@ test_ensure_parent_dirs (void)
GError *error = NULL; GError *error = NULL;
const char *pathname = "/foo/bar/baz"; const char *pathname = "/foo/bar/baz";
const char *checksum = "01234567890123456789012345678901"; const char *checksum = "01234567890123456789012345678901";
gs_free char *source_checksum = NULL; g_autofree char *source_checksum = NULL;
gs_unref_object OstreeMutableTree *source_subdir = NULL; gs_unref_object OstreeMutableTree *source_subdir = NULL;
gs_free char *source_checksum2 = NULL; g_autofree char *source_checksum2 = NULL;
gs_unref_object OstreeMutableTree *source_subdir2 = NULL; gs_unref_object OstreeMutableTree *source_subdir2 = NULL;
g_assert (ot_util_path_split_validate (pathname, &split_path, &error)); g_assert (ot_util_path_split_validate (pathname, &split_path, &error));
@ -116,7 +116,7 @@ test_ensure_dir (void)
const char *dirname = "foo"; const char *dirname = "foo";
const char *filename = "bar"; const char *filename = "bar";
const char *checksum = "01234567890123456789012345678901"; const char *checksum = "01234567890123456789012345678901";
gs_free char *source_checksum = NULL; g_autofree char *source_checksum = NULL;
gs_unref_object OstreeMutableTree *source_subdir = NULL; gs_unref_object OstreeMutableTree *source_subdir = NULL;
g_assert (ostree_mutable_tree_ensure_dir (tree, dirname, &parent, &error)); g_assert (ostree_mutable_tree_ensure_dir (tree, dirname, &parent, &error));
@ -139,7 +139,7 @@ test_replace_file (void)
g_assert (ostree_mutable_tree_replace_file (tree, filename, checksum, &error)); g_assert (ostree_mutable_tree_replace_file (tree, filename, checksum, &error));
{ {
gs_free char *out_checksum = NULL; g_autofree char *out_checksum = NULL;
gs_unref_object OstreeMutableTree *subdir = NULL; gs_unref_object OstreeMutableTree *subdir = NULL;
g_assert (ostree_mutable_tree_lookup (tree, filename, &out_checksum, &subdir, &error)); g_assert (ostree_mutable_tree_lookup (tree, filename, &out_checksum, &subdir, &error));
g_assert_cmpstr (checksum, ==, out_checksum); g_assert_cmpstr (checksum, ==, out_checksum);
@ -147,7 +147,7 @@ test_replace_file (void)
g_assert (ostree_mutable_tree_replace_file (tree, filename, checksum2, &error)); g_assert (ostree_mutable_tree_replace_file (tree, filename, checksum2, &error));
{ {
gs_free char *out_checksum = NULL; g_autofree char *out_checksum = NULL;
gs_unref_object OstreeMutableTree *subdir = NULL; gs_unref_object OstreeMutableTree *subdir = NULL;
g_assert (ostree_mutable_tree_lookup (tree, filename, &out_checksum, &subdir, &error)); g_assert (ostree_mutable_tree_lookup (tree, filename, &out_checksum, &subdir, &error));
g_assert_cmpstr (checksum2, ==, out_checksum); g_assert_cmpstr (checksum2, ==, out_checksum);

View File

@ -87,8 +87,8 @@ test_ot_parse_keyvalue (void)
for (i = 0; i < G_N_ELEMENTS (keyvalue); i++) for (i = 0; i < G_N_ELEMENTS (keyvalue); i++)
{ {
gs_free char *out_key = NULL; g_autofree char *out_key = NULL;
gs_free char *out_value = NULL; g_autofree char *out_value = NULL;
g_assert_true (ot_parse_keyvalue (keyvalue[i], g_assert_true (ot_parse_keyvalue (keyvalue[i],
&out_key, &out_key,
&out_value, &out_value,
@ -98,8 +98,8 @@ test_ot_parse_keyvalue (void)
} }
{ {
gs_free char *out_key = NULL; g_autofree char *out_key = NULL;
gs_free char *out_value = NULL; g_autofree char *out_value = NULL;
g_assert_false (ot_parse_keyvalue ("blabla", g_assert_false (ot_parse_keyvalue ("blabla",
&out_key, &out_key,
&out_value, &out_value,

View File

@ -36,7 +36,7 @@ check_one_roundtrip (guint64 val)
if (g_test_verbose ()) if (g_test_verbose ())
{ {
gs_unref_variant GVariant *v = g_variant_new_from_data (G_VARIANT_TYPE ("ay"), buf->str, buf->len, TRUE, NULL, NULL); gs_unref_variant GVariant *v = g_variant_new_from_data (G_VARIANT_TYPE ("ay"), buf->str, buf->len, TRUE, NULL, NULL);
gs_free char *data = g_variant_print (v, FALSE); g_autofree char *data = g_variant_print (v, FALSE);
g_test_message ("%" G_GUINT64_FORMAT " -> %s", val, data); g_test_message ("%" G_GUINT64_FORMAT " -> %s", val, data);
} }
g_assert (_ostree_read_varuint64 ((guint8*)buf->str, buf->len, &newval, &bytes_read)); g_assert (_ostree_read_varuint64 ((guint8*)buf->str, buf->len, &newval, &bytes_read));