mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-14 13:04:35 +03:00
Assert allocating non-zero size memory
Allocating zero size memory results in implementation-defined behavior: man:malloc(3) : If size is 0, then malloc() returns either NULL, or a unique pointer value that can later be successfully passed to free().
This commit is contained in:
2
Meter.c
2
Meter.c
@ -38,7 +38,7 @@ Meter* Meter_new(struct ProcessList_* pl, int param, const MeterClass* type) {
|
||||
this->param = param;
|
||||
this->pl = pl;
|
||||
this->curItems = type->maxItems;
|
||||
this->values = xCalloc(type->maxItems, sizeof(double));
|
||||
this->values = type->maxItems ? xCalloc(type->maxItems, sizeof(double)) : NULL;
|
||||
this->total = type->total;
|
||||
this->caption = xStrdup(type->caption);
|
||||
if (Meter_initFn(this))
|
||||
|
Reference in New Issue
Block a user