fix for use of uninitialized memory with opengl render.
authorCampbell Barton <ideasman42@gmail.com>
Thu, 1 Jul 2010 11:58:48 +0000 (11:58 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 1 Jul 2010 11:58:48 +0000 (11:58 +0000)
source/blender/editors/render/render_opengl.c

index 7cc074a74fdfd468249e9d4f5531c18ec1a40374..5881d50c30942c0d1daf7a5772cafb6c9076d994 100644 (file)
@@ -233,7 +233,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
 
        rr= RE_AcquireResultWrite(oglrender->re);
        if(rr->rectf==NULL)
-               rr->rectf= MEM_mallocN(sizeof(float)*4*sizex*sizey, "32 bits rects");
+               rr->rectf= MEM_callocN(sizeof(float)*4*sizex*sizey, "screen_opengl_render_init rect");
        RE_ReleaseResult(oglrender->re);
 
        return 1;
@@ -402,9 +402,10 @@ static int screen_opengl_render_modal(bContext *C, wmOperator *op, wmEvent *even
                        return OPERATOR_RUNNING_MODAL;
        }
 
-       ret= screen_opengl_render_anim_step(C, op);
-
+       /* run first because screen_opengl_render_anim_step can free oglrender */
        WM_event_add_notifier(C, NC_SCENE|ND_RENDER_RESULT, oglrender->scene);
+       
+       ret= screen_opengl_render_anim_step(C, op);
 
        /* stop at the end or on error */
        if(ret == 0) {