Nп/п : 38 из 100
 От   : The Natural Philosopher             2:5075/128        15 сен 23 15:32:45
 К    : Theo                                                  15 сен 23 17:35:01
 Тема : Re: Weird code crash
----------------------------------------------------------------------------------
                                                                                 
@MSGID: 1@dont-email.me> bcdff822
@REPLY: 5Arqz@news.chiark.greenend.org.uk>
8f646d19
@REPLYADDR The Natural Philosopher
<tnp@invalid.invalid>
@REPLYTO 2:5075/128 The Natural Philosopher
@CHRS: CP866 2
@RFC: 1 0
@RFC-Message-ID: 1@dont-email.me>
@RFC-References: 1@dont-email.me>
<ygamsxoixhx.fsf@akutech.de> 4@dont-email.me> <ygail8biyxm.fsf@akutech.de>
1@dont-email.me> <ygaedizitb9.fsf@akutech.de> 2@dont-email.me>
5Arqz@news.chiark.greenend.org.uk>
@TZUTC: 0100
@PID: Mozilla/5.0 (X11; Linux x86_64; rv:102.0)
Gecko/20100101 Thunderbird/102.15.1
@TID: FIDOGATE-5.12-ge4e8b94
On 15/09/2023 14:23, Theo wrote:
> You could get a SIGABRT if you were trying to free something that was
> already freed.  Are you sure those are interlocked such that for each i you
> call strdup() exactly once, and subsequently free() exactly once?  If there
> was some code path that was breaking out of the loop or similar you might
> get such behaviour.

Well, I am not sure if that was it or not, but I deleted manually a 
thermometer file and the thing crashed instantly.  That is consistent 
with the name having been set once, and then repeatedly free()ed. I then 
installed the code with the free()ed pointers set to NULL, and it 
*didn`t* crash instantly.


I had assumed that freeing a pointer that already had been freed would 
either result in a NO-OP because the pointer no longer existed in the 
heap memory allocation tables, or it would instantly crash , but it 
seems that the action is `undefined`.

Not sure that`s done the trick, because I don`t quite see how a file 
could ever cease to exist.

To not exist in the first place is one thing, but once written, nothing 
should delete them.

Unless fopen("w") does that for a fraction of a microsecond

Or fopen("w") creates an *empty* file, in which case it is *just* 
possible that an empty file is read, no strdup was done and the pointer 
was double freed...next time around.

Academic now anyway. Pointers all set to null after freeing. Defined 
behaviour.  frees on NULL ignored.

I`ll let it run and run and see.


-- 
The biggest threat to humanity comes from socialism, which has utterly 
diverted our attention away from what really matters to our existential 
survival, to indulging in navel gazing and faux moral investigations 
into what the world ought to be, whilst we fail utterly to deal with 
what it actually is.


 --- Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.15.1
 * Origin: A little, after lunch (2:5075/128)
SEEN-BY: 5001/100 5005/49 5015/255 5019/40 5020/715
848 1042 4441 12000
SEEN-BY: 5030/49 1081 5058/104 5075/128
@PATH: 5075/128 5020/1042 4441



   GoldED+ VK   │                                                 │   09:55:30    
                                                                                
В этой области больше нет сообщений.

Остаться здесь
Перейти к списку сообщений
Перейти к списку эх