Fix compiler warnings with uninitialised cleanup pointers

This change fixes GCC compiler warnings where a cleanup function was
specified on an uninitialised pointer, which in the view of GCC could
result in an errornous free of uninitialised memory, if the functions
that initialise them do not return NULL.

Signed-off-by: Ikey Doherty <ikey@solus-project.com>
tingping/wmclass
Ikey Doherty 2017-01-18 22:46:55 +00:00 committed by Alexander Larsson
parent 3b64fbc4f5
commit 605c7ee87b
9 changed files with 11 additions and 11 deletions

View File

@ -210,7 +210,7 @@ print_table_for_refs (gboolean print_apps, GPtrArray* refs_array, const char *ar
if (strcmp (parts[0], "app") == 0)
{
g_autofree char *current;
g_autofree char *current = NULL;
current = flatpak_dir_current_ref (dir, parts[1], cancellable);
if (current && strcmp (ref, current) == 0)

View File

@ -174,7 +174,7 @@ flatpak_usage (FlatpakCommand *commands,
gboolean is_error)
{
GOptionContext *context;
g_autofree char *help;
g_autofree char *help = NULL;
context = flatpak_option_context_new_with_commands (commands);
@ -344,7 +344,7 @@ flatpak_run (int argc,
if (!command->fn)
{
GOptionContext *context;
g_autofree char *help;
g_autofree char *help = NULL;
context = flatpak_option_context_new_with_commands (commands);

View File

@ -200,7 +200,7 @@ main (int argc,
g_autoptr(GFileEnumerator) dir_enum2 = NULL;
GFileInfo *next = NULL;
const char *platform_id = NULL;
g_autofree char **orig_argv;
g_autofree char **orig_argv = NULL;
gboolean is_run = FALSE;
gboolean is_show_deps = FALSE;
gboolean app_dir_is_empty = FALSE;

View File

@ -245,7 +245,7 @@ builder_source_bzr_checksum (BuilderSource *source,
BuilderContext *context)
{
BuilderSourceBzr *self = BUILDER_SOURCE_BZR (source);
g_autofree char *current_commit;
g_autofree char *current_commit = NULL;
g_autoptr(GError) error = NULL;

View File

@ -264,7 +264,7 @@ builder_source_extract (BuilderSource *self,
{
BuilderSourceClass *class;
g_autoptr(GFile) real_dest;
g_autoptr(GFile) real_dest = NULL;
class = BUILDER_SOURCE_GET_CLASS (self);

View File

@ -2603,7 +2603,7 @@ flatpak_dir_list_refs (FlatpakDir *self,
{
gboolean ret = FALSE;
g_autoptr(GFile) base;
g_autoptr(GFile) base = NULL;
g_autoptr(GFileEnumerator) dir_enum = NULL;
g_autoptr(GFileInfo) child_info = NULL;
GError *temp_error = NULL;

View File

@ -563,7 +563,7 @@ get_xdg_dir_from_string (const char *filesystem,
{
char *slash;
const char *rest;
g_autofree char *prefix;
g_autofree char *prefix = NULL;
const char *dir = NULL;
gsize len;
@ -597,7 +597,7 @@ get_xdg_user_dir_from_string (const char *filesystem,
{
char *slash;
const char *rest;
g_autofree char *prefix;
g_autofree char *prefix = NULL;
gsize len;
slash = strchr (filesystem, '/');

View File

@ -329,7 +329,7 @@ handle_set (XdgPermissionStore *object,
g_variant_iter_init (&iter, app_permissions);
while ((child = g_variant_iter_next_value (&iter)))
{
g_autoptr(FlatpakDbEntry) old_entry;
g_autoptr(FlatpakDbEntry) old_entry = NULL;
const char *child_app_id;
g_autofree const char **permissions;

View File

@ -663,7 +663,7 @@ flatpak_authorize_method_handler (GDBusInterfaceSkeleton *interface,
if (action)
{
g_autoptr(AutoPolkitAuthorizationResult) result;
g_autoptr(AutoPolkitAuthorizationResult) result = NULL;
g_autoptr(GError) error = NULL;
result = polkit_authority_check_authorization_sync (authority, subject,