mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-10-11 18:08:08 +00:00
[client/common] fixes for issues detected through static analysis.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user