# HG changeset patch # User Matti Hamalainen # Date 1589305752 -10800 # Node ID 470631c00c9797ef8ed9b93a75b09562fe286e30 # Parent 106f4426c7298d199ea55bafc960d447175f186d Implement optionality of loading address in dmC64EncodeBMP() as well. diff -r 106f4426c729 -r 470631c00c97 tools/lib64gfx.c --- a/tools/lib64gfx.c Tue May 12 20:31:23 2020 +0300 +++ b/tools/lib64gfx.c Tue May 12 20:49:12 2020 +0300 @@ -1631,9 +1631,13 @@ if ((res = dmGrowBufAlloc(buf, BUF_SIZE_INITIAL, BUF_SIZE_GROW)) != DMERR_OK) goto out; - // Add the loading address - if (!dmGrowBufPutU16LE(buf, fmt->addr)) + // Add the loading address, if needed + if (fmt->addr >= 0 && + !dmGrowBufPutU16LE(buf, fmt->addr)) + { + res = DMERR_MALLOC; goto out; + } // Attempt to encode the image to a buffer if (fmt->encode != NULL)