diff options
author | Ander Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com> | 2011-03-23 14:36:22 +0200 |
---|---|---|
committer | Ulrich Sibiller <uli42@gmx.de> | 2016-10-19 21:40:25 +0200 |
commit | 0f7148695beddf0a9fd9803547f48d3db1368c86 (patch) | |
tree | aab110217af0f136586027276778e06f9af0107d /nx-X11 | |
parent | 417e0411133ab2be648648d695fc51d4f1b13f3e (diff) | |
download | nx-libs-0f7148695beddf0a9fd9803547f48d3db1368c86.tar.gz nx-libs-0f7148695beddf0a9fd9803547f48d3db1368c86.tar.bz2 nx-libs-0f7148695beddf0a9fd9803547f48d3db1368c86.zip |
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: Ander Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
Diffstat (limited to 'nx-X11')
-rw-r--r-- | nx-X11/lib/X11/RdBitF.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/nx-X11/lib/X11/RdBitF.c b/nx-X11/lib/X11/RdBitF.c index b3c21bc53..2ec100aa3 100644 --- a/nx-X11/lib/X11/RdBitF.c +++ b/nx-X11/lib/X11/RdBitF.c @@ -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); |