X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=output%2Foutput_ols.c;h=5097de4b4c05a90f1f744c3e7025dab97be3b1e1;hb=b53738baf76219237e0a6629905981d7a1f2508e;hp=df94c8c92bb117b1f3490ddbeacdcb791ca5d772;hpb=50959ddcdc455c930397fbc9f85c3a745ff45fda;p=libsigrok.git diff --git a/output/output_ols.c b/output/output_ols.c index df94c8c9..5097de4b 100644 --- a/output/output_ols.c +++ b/output/output_ols.c @@ -29,6 +29,7 @@ #include #include #include +#include #include "config.h" struct context { @@ -45,8 +46,10 @@ static int init(struct sr_output *o) uint64_t samplerate; int num_enabled_probes; - if (!(ctx = g_malloc(sizeof(struct context)))) + if (!(ctx = g_try_malloc(sizeof(struct context)))) { + sr_err("ols out: %s: ctx malloc failed", __func__); return SR_ERR_MALLOC; + } o->internal = ctx; ctx->num_samples = 0;