mirror of
https://gitlab.freedesktop.org/xorg/lib/libx11.git
synced 2026-05-05 09:58:10 +02:00
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>
This commit is contained in:
parent
c1c91e9a22
commit
1a94426018
1 changed files with 5 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue