iperf icon indicating copy to clipboard operation
iperf copied to clipboard

Implement Error Handling for Memory Allocation Functions

Open KellyLTran opened this issue 1 year ago • 1 comments

PLEASE NOTE the following text from the iperf3 license. Submitting a pull request to the iperf3 repository constitutes "[making] Enhancements available...publicly":

You are under no obligation whatsoever to provide any bug fixes, patches, or
upgrades to the features, functionality or performance of the source code
("Enhancements") to anyone; however, if you choose to make your Enhancements
available either publicly, or directly to Lawrence Berkeley National
Laboratory, without imposing a separate written license agreement for such
Enhancements, then you hereby grant the following license: a non-exclusive,
royalty-free perpetual license to install, use, modify, prepare derivative
works, incorporate into other computer software, distribute, and sublicense
such enhancements or derivative works thereof, in binary and source code form.

The complete iperf3 license is available in the LICENSE file in the top directory of the iperf3 source tree.

  • Version of iperf3 (or development branch, such as master or 3.1-STABLE) to which this pull request applies:

  • Issues fixed (if any):

  • Brief description of code changes (suitable for use as a commit message): This pull request implements error handling for the memory allocation functions involving the "malloc" and "calloc" functions. Particularly focused on return values for error cases, this pull request clarifies when certain memory allocations do not work, which allows developers to clearly identify mistakes and where the issue is. Error messages are also used for code readability and clarity. This aims to make testing and bug fixing easier and more efficient.

KellyLTran avatar Feb 10 '24 00:02 KellyLTran

Thanks for the pull request! Er, did you mean for those Zone.Identifier files to be added?

EDIT: I agree that giving more diagnostic information to help fix flaws are good.

One of the reasons that iperf3 is fairly terse with error messages is that in some places, printing out diagnostics can interfere with JSON output. This isn't the case everywhere but it requires a little thought about how to express additional information such as what you're proposing to do.

bmah888 avatar May 30 '24 15:05 bmah888