Ticket #2057 (closed enhancement: invalid)

Opened 15 years ago

Last modified 15 years ago

lib-vfs-mc-vfs-extfs.c-UN-need-goto

Reported by: vit_r Owned by:
Priority: trivial Milestone:
Component: mc-vfs Version:
Keywords: Cc:
Blocked By: Blocking:
Branch state: Votes for changeset:

Description (last modified by andrew_b) (diff)

a try to simplify ("nothing" is changed)

Attachments

2057-lib-vfs-mc-vfs-extfs.c-UN-need-goto.patch (5.2 KB) - added by vit_r 15 years ago.

Change History

Changed 15 years ago by vit_r

comment:1 Changed 15 years ago by andrew_b

  • Description modified (diff)

What about #2033?

comment:2 follow-up: ↓ 3 Changed 15 years ago by andrew_b

  • Status changed from new to closed
  • Version master deleted
  • Resolution set to invalid
  • Milestone 4.7 deleted
973	972	    q = extfs_get_path_mangle (me, mpath, &archive, FALSE); 
 	973	    g_free (mpath); 
974	974	    if (q == NULL) 
975	 	        goto cleanup; 
 	975	        return -1; 
 	976	 
976	977	    entry = extfs_find_entry (archive->root_entry, q, FALSE, FALSE); 

The result of extfs_get_path_mangle() cannot be free immediately after function call because it points to function argument (mpath in this case).

comment:3 in reply to: ↑ 2 ; follow-up: ↓ 4 Changed 15 years ago by vit_r

The result of extfs_get_path_mangle() cannot be free immediately after function
call because it points to function argument (mpath in this case).

But "nothing" is changed
It is only a try to simplify text
The result of extfs_get_path_mangle() is not freed (as it was not freed)

'g_free (mpath);' was at the end of funcs
and now it is immediately after using it in call


This patch is correct and is much better then prev version #2033


When code is more clear looking it makes it easier to go ahead

May be a prove is just around the corner


Please look once more

comment:4 in reply to: ↑ 3 ; follow-ups: ↓ 5 ↓ 6 Changed 15 years ago by andrew_b

Replying to vit_r:

The result of extfs_get_path_mangle() cannot be free immediately after function
call because it points to function argument (mpath in this case).

But "nothing" is changed
It is only a try to simplify text
The result of extfs_get_path_mangle() is not freed (as it was not freed)

Sorry, I was incorrect.

'g_free (mpath);' was at the end of funcs
and now it is immediately after using it in call

I meant that mpath cannot be freed immediately after call of extfs_get_path_mangle() because q (the returned value of extfs_get_path_mangle()) points to the part of mpath. If you delete mpath, q will point to deallocated memory.

comment:5 in reply to: ↑ 4 Changed 15 years ago by vit_r

Replying to andrew_b:
Thanks
Actually (I really think so)

it is my prev fault (invalid patch trying g_free (q))


Bugs are surviving by helping each other to multiply ...

But most important (sorry about asking):

Did You applied this patch to see quit obvious bug (at least one) ?

And thanks for fast reply also

And one more thing
i'm 'hunted' everyday by one idea ... better to leave for the room
(coming to the room scares me (i'im almost pissed out) ... :-(O )
but i'll come for sure ( I sincerely hope ... i'll knock )

And great happening: '_vfs_get_cwd ();'
I'm now armed
You gave me the proof i was searching for
to use in arguing with dev-team ... ahead ...

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

Replying to andrew_b:

I meant that mpath cannot be freed immediately after call of >extfs_get_path_mangle() because q (the returned value of extfs_get_path_mangle()) >points to the part of mpath. If you delete mpath, q will point to deallocated >memory.

Thanks, You are right !
My testing was shallow, because it was only MC
In real situation freed mem can be used by OS and 'q' would be corrupted


Great lesson.

Still can I try once more ?

Note: See TracTickets for help on using tickets.