diff --git a/src/main.c b/src/main.c index 007968d..100f914 100644 --- a/src/main.c +++ b/src/main.c @@ -183,6 +183,7 @@ int main(void) { struct sensors_t *sensors = malloc(sizeof(*sensors)); // no actual point in mallocing and it is ever so sligtly slower to access heap vs stack, but its cool if (sensors == nullptr) { applog(LOG_ERR, "can't allocate mem for the sensor struct. You don't got %lu bytes bro?", sizeof(*sensors)); + free(sensors); return 1; } applog(LOG_INF, "sensor struct allocated, size is %lu bytes", sizeof(*sensors));