Introduction
Introduction Statistics Contact Development Disclaimer Help
drw.c: Avoid potential memory leak in drw_cur_create() - sent - simple plaintex…
git clone git://git.suckless.org/sent
Log
Files
Refs
README
LICENSE
---
commit 996a4c5c6e7b98c9f3ef50846f567b5d6a2da932
parent 243c8cf7b6e66813609ac4ca9c9e6343408e1d72
Author: Quentin Rameau <[email protected]>
Date: Wed, 18 Nov 2015 22:45:26 +0100
drw.c: Avoid potential memory leak in drw_cur_create()
If drw was NULL, memory was still allocated for cur.
Diffstat:
M drw.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/drw.c b/drw.c
@@ -396,9 +396,9 @@ drw_font_getexts(Fnt *font, const char *text, unsigned int …
Cur *
drw_cur_create(Drw *drw, int shape) {
- Cur *cur = (Cur *)calloc(1, sizeof(Cur));
+ Cur *cur;
- if(!drw || !cur)
+ if(!drw || !(cur = (Cur *)calloc(1, sizeof(Cur))))
return NULL;
cur->cursor = XCreateFontCursor(drw->dpy, shape);
return cur;
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.