int read_bytes = util::read_atmost_n(
fdopen(err_rd_pipe, "r"),
err_buf,
SP_MAX_ERR_BUF_SIZ);
close(err_rd_pipe);
The value returned by fdopen() is not closed. This causes memory leak.
If you call fclose(), it will close err_rd_pipe. So close(err_rd_pipe) is not necessary.
In the following code:
The value returned by fdopen() is not closed. This causes memory leak. If you call fclose(), it will close err_rd_pipe. So close(err_rd_pipe) is not necessary.