Bug 26721 - several uninitialized GError's in pk-transaction.c
Summary: several uninitialized GError's in pk-transaction.c
Status: RESOLVED FIXED
Alias: None
Product: PackageKit
Classification: Unclassified
Component: core (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium minor
Assignee: Richard Hughes
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-23 21:26 UTC by Jonathan Conder
Modified: 2010-02-23 23:58 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
initialize relevant GError's to NULL (8.28 KB, patch)
2010-02-23 21:26 UTC, Jonathan Conder
Details | Splinter Review

Description Jonathan Conder 2010-02-23 21:26:24 UTC
Created attachment 33518 [details] [review]
initialize relevant GError's to NULL

Hi, I've been debugging a packagekit backend for my distribution (Arch Linux) and came across a GLib warning about setting a GError twice. I did a grep for uninitialized GError's and found lots in src/pk-transaction.c, which I assume was why the warnings occured. Attached is a patch to fix this.

There are a few others occurences of this in other files but none of them matter because the errors are set directly with g_error_new. However I think it would perhaps be better practice to consistently use g_set_error instead, so that if more code gets added to those functions this bug will not be reintroduced.
Comment 1 Jonathan Conder 2010-02-23 21:29:30 UTC
I forgot to mention, this patch is against 0.6.1. The problem still exists in git master though (e.g. on line 2873), and hopefully the patch will still work
Comment 2 Richard Hughes 2010-02-23 23:58:28 UTC
commit fb4669c72d0e17065c9aecb30ddb746099bcbef2
Author: Jonathan Conder <j@skurvy.no-ip.org>
Date:   Wed Feb 24 07:57:47 2010 +0000

    Initialize relevant GError's to NULL
    
    Hi, I've been debugging a packagekit backend for my distribution (Arch Linux)
    and came across a GLib warning about setting a GError twice. I did a grep for
    uninitialized GError's and found lots in src/pk-transaction.c, which I assume
    was why the warnings occured. Attached is a patch to fix this.
    
    Signed-off-by: Richard Hughes <richard@hughsie.com>



Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.