# HG changeset patch # User Matti Hamalainen # Date 1526069476 -10800 # Node ID 24b8b452925ea4bea68b83f3a9a57400808316c5 # Parent 1be17c662b8eb08f145b7bfd80ca7e078801f4f7 Improve error handling of RLE encoder. diff -r 1be17c662b8e -r 24b8b452925e tools/lib64gfx.c --- a/tools/lib64gfx.c Fri May 11 23:10:21 2018 +0300 +++ b/tools/lib64gfx.c Fri May 11 23:11:16 2018 +0300 @@ -377,11 +377,7 @@ if (data != prev || count >= cfg->rleMaxCount) { if (!dmEncodeGenericRLESequence(dst, prev, count, cfg)) - { - res = dmError(DMERR_MALLOC, - "Could reallocate memory for RLE encoding buffer.\n"); goto err; - } count = 1; } @@ -391,10 +387,14 @@ prev = data; } - res = DMERR_OK; + if (!dmEncodeGenericRLESequence(dst, prev, count, cfg)) + goto err; + + return DMERR_OK; err: - return res; + return dmError(DMERR_MALLOC, + "Could reallocate memory for RLE encoding buffer.\n"); }