aboutsummaryrefslogtreecommitdiff
path: root/nx-X11
diff options
context:
space:
mode:
authorAnder Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com>2011-03-23 14:36:22 +0200
committerUlrich Sibiller <uli42@gmx.de>2016-10-19 21:40:25 +0200
commit0f7148695beddf0a9fd9803547f48d3db1368c86 (patch)
treeaab110217af0f136586027276778e06f9af0107d /nx-X11
parent417e0411133ab2be648648d695fc51d4f1b13f3e (diff)
downloadnx-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.c5
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);