Ticket #1855 (closed defect: wontfix)

Opened 9 years ago

Last modified 9 years ago

missing check in src/mcconfig/get.c mc_config_get_groups()

Reported by: vit_r Owned by: vit_r
Priority: major Milestone: 4.7
Component: mc-config-ini Version: 4.7.0-pre4
Keywords: Cc:
Blocked By: Blocking:
Branch state: Votes for changeset:

Description

This obvious correction is raising some questions and may be other corrections. While experts can have a look i'll try
to prepare enveloping patch(to add to this ticket).

Attachments

1855-missing-check-in-src_mcconfig_get.c-mc_config_-2.patch (3.3 KB) - added by vit_r 9 years ago.
enveloping previous patch for discussing
1855-missing-check-in-src_mcconfig_get.c-mc_config_get_gr.patch (1.0 KB) - added by vit_r 9 years ago.
Doubled fix

Change History

comment:1 Changed 9 years ago by vit_r

  • Owner set to vit_r
  • Status changed from new to accepted

comment:2 follow-up: ↓ 4 Changed 9 years ago by andrew_b

You cannot write access to the repo, so don't take ownership and accept of the ticket to youself.

Changed 9 years ago by vit_r

enveloping previous patch for discussing

comment:3 Changed 9 years ago by vit_r

Its for discussing:

Seems, master (cloned 20091203-1103) has next five calls to this func:

I.
src/setup.c

gsize groups_count; <- _NOT_ used

504:

curr_grp = groups = mc_config_get_groups (tmp_cfg, &groups_count);
if (!groups)
{

mc_config_deinit(tmp_cfg);
return;

}

II.
src/filehighlight/ini-file-read.c

gsize ftype_names_size; <- _NOT_ used

251:

orig_group_names = group_names = mc_config_get_groups (fhl->config, &ftype_names_size);

if (group_names == NULL)

return FALSE;

III.
src/skin/colors.c

gsize items_count; <- _NOT_ used

259:

orig_groups = groups = mc_config_get_groups (mc_skin->config, &items_count);

if (groups == NULL)

return;

IV.
src/skin/colors.c

gsize items_count; <- is used, - see L 307

294:

orig_groups = groups = mc_config_get_groups (mc_skin->config, &items_count);

if (groups == NULL
*groups == NULL) {

if (groups != NULL)

g_strfreev (groups);

return FALSE;

}

307:

orig_keys = keys = mc_config_get_keys (mc_skin->config, *groups, &items_count);

if (keys == NULL
*keys == NULL) {

if (keys != NULL)

g_strfreev (keys);

continue;

}

V.
src/mcconfig/common.c

210:

groups = mc_config_get_groups (tmp_config, NULL);

for (curr_grp = groups; *curr_grp != NULL; curr_grp++) {

--

In cases I, II and III _NOT_ used vars are deleted

In cases IV items_count is used _BUT_

if (groups == NULL ...) {

if (groups != NULL)

}

if (keys == NULL ...) {

if (keys != NULL)

}

look strange and may be want to be rewritten

In cases V added

if (!groups)

return FALSE;


In func added

return NULL;

But such questions:

  1. Was there a chance for mc_config_get_groups () to return NULL ?
  2. And seems src/mcconfig/*.c are out yet, because no src/mcconfig/*.o after make appear then why they are there? New stuff? Hope above will be not in vain

comment:4 in reply to: ↑ 2 Changed 9 years ago by vit_r

Replying to andrew_b:

You cannot write access to the repo, so don't take ownership and accept of the ticket to youself.

Sorry
i know, but when ticket was created it did not apeare in My_tickets-list (more then one hour). And it was assigned as my and searching by number was found.
And I thought the Trac should prevent my wrong action.
Can You explain what to do in such case, please.
And reassign it as new one instead of accepted , please.
I don't know why this happened. Next time I will be more careful

vit_r

Changed 9 years ago by vit_r

Doubled fix

comment:5 Changed 9 years ago by andrew_b

  • Blocking 1845 added

comment:6 Changed 9 years ago by slavazanko

  • Status changed from accepted to testing
  • Resolution set to wontfix
  • Blocking 1845 removed

Will applied into 1845

comment:7 Changed 9 years ago by slavazanko

  • Status changed from testing to closed
Note: See TracTickets for help on using tickets.