You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Partially related to #190 , the source code is filled with memory allocations and zero filling like the following one:
ptr = malloc( ... );
memset( ptr, 0, ...);
wouldn't be possible to substitute this with calloc(3)? According to the documentation:
The calloc() function allocates memory for an array of nmemb elements of size bytes each and returns a pointer to the allocated memory. The memory is set to zero.
Internally calloc checks for overflow as you said, so that is the main difference. Either way I would say, since we don't have memset in the message read/write path.
Partially related to #190 , the source code is filled with memory allocations and zero filling like the following one:
wouldn't be possible to substitute this with
calloc(3)
? According to the documentation:As an example, consider https://github.com/agroal/pgagroal/blob/master/src/libpgagroal/utils.c#L125:
would become
Another advantage, that should not happen in pgagroal, is that calloc detects size overflows (integer computation), while malloc does not.
The text was updated successfully, but these errors were encountered: