Commit 0f714869 authored by Ander Conselvan de Oliveira's avatar Ander Conselvan de Oliveira Committed by Ulrich Sibiller

Fix memory leak with broken bitmap files in XReadBitmapFileData

Bitmap file data is read looping through the lines in the input file. If there is extra data after the bitmap, these lines will be processed and if this data represents another bitmap it will replace the one read before causing the memory allocated for bits to leak. This changes the code to stop processing the file once a bitmap was read. Signed-off-by: 's avatarAnder Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com> Reviewed-by: 's avatarAlan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: 's avatarUlrich Sibiller <uli42@gmx.de>
parent 417e0411
......@@ -216,6 +216,11 @@ XReadBitmapFileData (
*ptr=value;
}
}
/* If we got to this point, we read a full bitmap file. Break so we don't
* start reading another one from the same file and leak the memory
* allocated for the previous one. */
break;
} /* end while */
fclose(fstream);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment