Re: [PATCHv2] debuginfod: Check result of calling MHD_add_response_header.

2021-12-01 Thread Frank Ch. Eigler via Elfutils-devel
Hi - > Although unlikely the MHD_add_response_header can fail for > various reasons. If it fails something odd is going on. > So check we can actually add a response header and log an > error if we cannot. TBH I wouldn't bother even this much checking. It just uglifies the code. If it would ma

[PATCHv2] debuginfod: Check result of calling MHD_add_response_header.

2021-12-01 Thread Mark Wielaard
Although unlikely the MHD_add_response_header can fail for various reasons. If it fails something odd is going on. So check we can actually add a response header and log an error if we cannot. Signed-off-by: Mark Wielaard --- This version only check and logs the error, but still uses the resp

[PATCH] debuginfod: Use gmtime_r instead of gmtime to avoid data race

2021-12-01 Thread Mark Wielaard
Since we are multi-threaded using gmtime might cause a data race because gmtime reuses a global struct to write data into. Make sure that each thread uses their own struct tm and use gmtime_r instead. Signed-off-by: Mark Wielaard --- debuginfod/ChangeLog | 5 + debuginfod/debuginfod.cx

[PATCH] debuginfod: Fix some memory leaks on debuginfod-client error paths.

2021-12-01 Thread Mark Wielaard
In a couple of places we might leak some memory when we encounter an error. tmp_url might leak if realloc failed. escaped_string might leak when setting up the data handle fails and we don't use it. And one of the goto out1 should have been goto out2 to make sure we release all allocated resources

Re: [PATCH] debuginfod: Check result of calling MHD_add_response_header.

2021-12-01 Thread Mark Wielaard
H Frank, On Wed, 2021-12-01 at 07:02 -0500, Frank Ch. Eigler wrote: > Although unlikely the MHD_add_response_header can fail for > > various reasons. If it fails something odd is going on. > > So check we can actually add a response header before using > > the response. > > ISTM it is okay to se

Re: [PATCH] debuginfod: Check result of calling MHD_add_response_header.

2021-12-01 Thread Frank Ch. Eigler via Elfutils-devel
Hi - > Although unlikely the MHD_add_response_header can fail for > various reasons. If it fails something odd is going on. > So check we can actually add a response header before using > the response. ISTM it is okay to send the response object (the body), even if something goes wrong with addi

[PATCH] debuginfod: Check result of calling MHD_add_response_header.

2021-12-01 Thread Mark Wielaard
Although unlikely the MHD_add_response_header can fail for various reasons. If it fails something odd is going on. So check we can actually add a response header before using the response. Signed-off-by: Mark Wielaard --- debuginfod/ChangeLog | 10 +++ debuginfod/debuginfod.cxx | 127