summaryrefslogtreecommitdiff
path: root/recordmydesktop/src/rectinsert.c
diff options
context:
space:
mode:
authoriovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2006-10-01 00:18:03 +0000
committeriovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2006-10-01 00:18:03 +0000
commitecdc60f49dd56d6cb9253d0105a85027abeb414d (patch)
tree19dc3c910cf9da35c7ef6df72d8647da19df354b /recordmydesktop/src/rectinsert.c
parent6d529d133342903f66532231daa301c39784d521 (diff)
major memory leakage fixed
git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@75 f606c939-3180-4ac9-a4b8-4b8779d57d0a
Diffstat (limited to 'recordmydesktop/src/rectinsert.c')
-rw-r--r--recordmydesktop/src/rectinsert.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/recordmydesktop/src/rectinsert.c b/recordmydesktop/src/rectinsert.c
index 3bec07d..a4bb7a6 100644
--- a/recordmydesktop/src/rectinsert.c
+++ b/recordmydesktop/src/rectinsert.c
@@ -152,7 +152,11 @@ int CollideRects(WGeometry *wgeom1,WGeometry *wgeom2,WGeometry **wgeom_return,in
//if the first one breaks(which is already inserted)
//then we reenter the part that was left and the one
//that was to be inserted
- wgeom_return[1]=wgeom2;
+// wgeom_return[1]=wgeom2;
+ wgeom_return[1]->x=wgeom2->x;
+ wgeom_return[1]->y=wgeom2->y;
+ wgeom_return[1]->width=wgeom2->width;
+ wgeom_return[1]->height=wgeom2->height;
// wgeom_return[0]=(WGeometry *)malloc(sizeof(WGeometry));
wgeom_return[0]->x=wgeom1->x;
wgeom_return[0]->y=wgeom1->y;
@@ -268,7 +272,7 @@ int CollideRects(WGeometry *wgeom1,WGeometry *wgeom2,WGeometry **wgeom_return,in
int RectInsert(RectArea **root,WGeometry *wgeom){
int total_insertions=0;
- RectArea *temp,*newnode=(RectArea *)malloc(sizeof(RectArea));
+ RectArea *temp=NULL,*newnode=(RectArea *)malloc(sizeof(RectArea));
//align
//we do need to know boundaries
wgeom->width+=(wgeom->width%2)|(wgeom->x%2);
@@ -466,6 +470,9 @@ int RectInsert(RectArea **root,WGeometry *wgeom){
break;
}
};
+
+ free(wgeom_return[0]);
+ free(wgeom_return[1]);
}
return total_insertions;
}
© All Rights Reserved