Ticket #1857 (closed defect: fixed)

Opened 14 years ago

Last modified 14 years ago

fixing some g_malloc callsNreturn

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

Description (last modified by andrew_b) (diff)

It's only pointing to start with.
For check of all calls MC-style-guider is wanted.


Attachments

1857-fixing-some-g_malloc-callsNreturn.patch (5.0 KB) - added by vit_r 14 years ago.
1857-fixing-some-mem_alloc-calls.patch (119 bytes) - added by vit_r 14 years ago.
For this patch is ctreated new ticket #1863

Change History

Changed 14 years ago by vit_r

comment:1 follow-up: ↓ 2 Changed 14 years ago by andrew_b

  • Description modified (diff)

g_malloc() never returns NULL and aborts program on failure. g_try_malloc() should be used instead.

comment:2 in reply to: ↑ 1 Changed 14 years ago by vit_r

Replying to andrew_b:

g_malloc() never ...

Great lesson !
Thanks !
Please, what about g_malloc-calls:

    mc_search_t *lc_mc_search;
    lc_mc_search = g_malloc0 (sizeof (*lc_mc_search));

g_malloc-call allows declaration 'mc_search_t *lc_mc_search; ' to be cganged
'lc_mc_search = g_malloc0 (sizeof (*lc_mc_search));' will remain the same

And in next case(from MC)

    mc_search_t *lc_mc_search;
    lc_mc_search = g_malloc0 (sizeof (mc_search_t));

both lines should be edited

To leave similar cases as they are now ?

comment:3 Changed 14 years ago by vit_r

Logicall design:

if [ g_Xalloc(which failing does _NOT_ return NULL) ]; then

If (retval _IS_ checked); then

g_Xalloc is replaced by g_try_Xalloc(failing returns NULL)

fi

elif [ Xalloc(failing returns NULL) ]; then

If (retval is _NOT_ checked); then

Xalloc is replaced by g_Xalloc(failing aborts)

fi

fi

Changed 14 years ago by vit_r

For this patch is ctreated new ticket #1863

comment:4 follow-up: ↓ 6 Changed 14 years ago by andrew_b

Why? What reason for that?

comment:5 Changed 14 years ago by andrew_b

  • Blocking 1845 added

comment:6 in reply to: ↑ 4 Changed 14 years ago by vit_r

Replying to andrew_b:

Why? What reason for that?

Because this 1857-fixing-some-g_malloc-callsNreturn.patch is wrong
As there is no possibility to remove one file then please remove 1857 ticket

If i could rename the file i would replace it then rename.

         Why  file  can  _NOT_  be deleted ?  Quit strange..

Sorry for problems

comment:7 Changed 14 years ago by andrew_b

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

Applied in #1845.

comment:8 Changed 14 years ago by andrew_b

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

comment:9 Changed 14 years ago by andrew_b

  • Status changed from testing to closed

comment:10 Changed 14 years ago by andrew_b

  • Milestone changed from 4.7 to 4.7.0
Note: See TracTickets for help on using tickets.