]> sigrok.org Git - libsigrok.git/blobdiff - output/text/text.c
ascii: fix for big-endian architectures.
[libsigrok.git] / output / text / text.c
index 31bf3989eb4e77d5d5ca05e1fafe67dbfa735965..674fa8867e3eb492263b6131c86da5e2a4cc627d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * This file is part of the sigrok project.
+ * This file is part of the libsigrok project.
  *
  * Copyright (C) 2013 Bert Vermeulen <bert@biot.com>
  * Copyright (C) 2011 HÃ¥vard Espeland <gus@ping.uio.no>
@@ -154,6 +154,12 @@ SR_PRIV int init(struct sr_output *o, int default_spl, enum outputmode mode)
                ret = SR_ERR_MALLOC;
        }
 
+       if (mode == MODE_ASCII &&
+                       !(ctx->prevsample = g_try_malloc0(num_probes / 8))) {
+               sr_err("%s: ctx->prevsample malloc failed", __func__);
+               ret = SR_ERR_MALLOC;
+       }
+
 err:
        if (ret != SR_OK) {
                g_free(ctx->header);