X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=datastore.c;h=11ae0e15ce039d69efb6e8b93515536d4a0be211;hb=b53738baf76219237e0a6629905981d7a1f2508e;hp=7f35ee5aae5b343101d579be4d6ea1ef03169e73;hpb=50959ddcdc455c930397fbc9f85c3a745ff45fda;p=libsigrok.git diff --git a/datastore.c b/datastore.c index 7f35ee5a..11ae0e15 100644 --- a/datastore.c +++ b/datastore.c @@ -34,8 +34,10 @@ int sr_datastore_new(int unitsize, struct sr_datastore **ds) if (unitsize <= 0) return SR_ERR; /* TODO: Different error? */ - if (!(*ds = g_malloc(sizeof(struct sr_datastore)))) + if (!(*ds = g_try_malloc(sizeof(struct sr_datastore)))) { + sr_err("ds: %s: ds malloc failed", __func__); return SR_ERR_MALLOC; + } (*ds)->ds_unitsize = unitsize; (*ds)->num_units = 0;