[client/common] fixes for issues detected through static analysis.

This commit is contained in:
Geoffrey McRae
2022-03-07 10:13:54 +11:00
parent a3820536ab
commit 3a8cb6a613
18 changed files with 228 additions and 24 deletions

View File

@@ -19,6 +19,7 @@
*/
#include "common/runningavg.h"
#include "common/debug.h"
#include <stdlib.h>
@@ -33,6 +34,12 @@ struct RunningAvg
RunningAvg runningavg_new(int length)
{
struct RunningAvg * ra = calloc(1, sizeof(*ra) + sizeof(*ra->values) * length);
if (!ra)
{
DEBUG_ERROR("out of memory");
return NULL;
}
ra->length = length;
return ra;
}