Bug 113763 - six bugs found at compile time
Summary: six bugs found at compile time
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: evolution
Version: 1
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Dave Malcolm
QA Contact:
URL:
Whiteboard:
Keywords: Patch
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-01-17 11:47 UTC by d.binderman
Modified: 2007-11-30 22:10 UTC (History)
1 user (show)

(edit)
Clone Of:
(edit)
Last Closed: 2004-05-18 01:45:32 UTC


Attachments (Terms of Use)
memleak and minor bugs (2.80 KB, patch)
2004-02-01 14:04 UTC, Bart Martens
no flags Details | Diff

Description d.binderman 2004-01-17 11:47:10 UTC
Description of problem:

I just tried to compile package evolution-1.4.5-7, from Redhat
Fedora Core 1.

The compiler said

1.

sspm.c(1172): remark #592: variable "cc" is used before its value is set

The source code is

    int cc;
    char buf[4] = {0,0,0,0};
    int p = 0;
    int valid_data = 0;
    size_t size_out=0;

    while (*src && p<(int)*size && (cc!=  -1)) {

I think the compiler is correct. Suggest initialise cc before first use.


2.

e-timezone-dialog.c(139): remark #592: variable "dialog" is used
before its value is set

The source code is

        GtkWidget *dialog;

        g_return_if_fail (object != NULL);
        g_return_if_fail (E_IS_TIMEZONE_DIALOG (object));

        etd = E_TIMEZONE_DIALOG (object);
        priv = etd->priv;

        /* Destroy the actual dialog. */
        if (dialog != NULL) {


Suggest initialise variable "dialog" before first use.


3.

../mail/mail-callbacks.h(132): error: invalid specifier on a parameter

The source code is

  void forward_messages    (CamelFolder *folder, GPtrArray *uids,
gboolean inline);

Suggest select a better name for the third parameter than "inline",
which is a reserved word for most C compilers.


4.

netscape-importer.c(319): warning #175: subscript out of range

The source code is

                } else if (!strcmp (type,
ns_filter_condition_types[AGE_IN_DAYS])) {

but

typedef enum {
        FROM, SUBJECT, TO, CC, TO_OR_CC, BODY, DATE, PRIORITY,
        STATUS, AGE_IN_DAYS, X_MSG_HEADER
} NsFilterConditionType;

so AGE_IN_DAYS has the value 9, but 

static char *ns_filter_condition_types[] =
{
        "from", "subject", "to", "CC", "to or CC", "body", "date",
        "priority", "age in days"
};

there are only 9 array elements. Arrays in C are exclusive, not inclusive


5.

netscape-importer.c(321): warning #175: subscript out of range

Duplicate. X_MSG_HEADER has the value 10.


6.

mail-config.c(1218): remark #592: variable "source" is used before its
value is
set

The source code is

        GNOME_Evolution_MailConfig_Service source, transport;
        GNOME_Evolution_MailConfig_Identity id;
        EAccount *new;

        if (mail_config_get_account_by_name (account->name)) {
                /* FIXME: we need an exception. */
                return;
        }

        new = e_account_new ();
        new->name = g_strdup (account->name);
        new->enabled = source.enabled;

Here again, source is read from before it is initialised.



Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Bart Martens 2004-02-01 14:04:13 UTC
Created attachment 97403 [details]
memleak and minor bugs

1. Implicit init was good, added an explicit init.
2. Memory leak fixed. The dialog was never freed.
3. Removed obsolete function declaration from include file.
4. Added missing value in array.
5. Added missing value in array.
6. Use variable after assignment, not before.

Comment 2 Jef Spaleta 2004-02-12 03:15:45 UTC
Is there an upstream bug at ximian about these leaks
that could be referenced here?


Comment 3 Dave Malcolm 2004-05-05 20:41:30 UTC
Looking at CVS HEAD, for Evolution 1.5.*:
1. is now in evolution-data-server and has been fixed.
2. appears to have been fixed in CVS
3. file doesn't appear to exist anymore in CVS HEAD
4. appears to have been rewritten, though the enum/array mismatch is
still present in CVS...
5. ...which causes this, which looks like a genuine bug.  I've filed
this in Ximian's Bugzilla as bug #58090
6. This code appears not to exist anymore



Note You need to log in before you can comment on or make changes to this bug.