Fixed errors detected by valgrind. gsoc2009_unit_tests
authorEdgar Simo <bobbens@gmail.com>
Tue, 04 Aug 2009 16:39:15 +0000
branchgsoc2009_unit_tests
changeset 3747 f7a3a47e6b50
parent 3746 be037e51f080
child 3748 9428ae743878
Fixed errors detected by valgrind.
test/automated/render/render.c
--- a/test/automated/render/render.c	Tue Aug 04 16:34:04 2009 +0000
+++ b/test/automated/render/render.c	Tue Aug 04 16:39:15 2009 +0000
@@ -570,15 +570,15 @@
    if (SDL_ATassert( "SDL_CreateTextureFromSurface", tface != 0))
       return -1;
 
-   /* Clean up. */
-   SDL_FreeSurface( face );
-
    /* Constant values. */
    rect.w = face->w;
    rect.h = face->h;
    ni     = SCREEN_W - face->w;
    nj     = SCREEN_H - face->h;
 
+   /* Clean up. */
+   SDL_FreeSurface( face );
+
    /* Loop blit. */
    for (j=0; j <= nj; j+=4) {
       for (i=0; i <= ni; i+=4) {
@@ -631,15 +631,15 @@
    if (SDL_ATassert( "SDL_CreateTextureFromSurface", tface != 0))
       return -1;
 
-   /* Clean up. */
-   SDL_FreeSurface( face );
-
    /* Constant values. */
    rect.w = face->w;
    rect.h = face->h;
    ni     = SCREEN_W - face->w;
    nj     = SCREEN_H - face->h;
 
+   /* Clean up. */
+   SDL_FreeSurface( face );
+
    /* Test blitting with colour mod. */
    for (j=0; j <= nj; j+=4) {
       for (i=0; i <= ni; i+=4) {
@@ -698,15 +698,15 @@
    if (SDL_ATassert( "SDL_CreateTextureFromSurface", tface != 0))
       return -1;
 
-   /* Clean up. */
-   SDL_FreeSurface( face );
-
    /* Constant values. */
    rect.w = face->w;
    rect.h = face->h;
    ni     = SCREEN_W - face->w;
    nj     = SCREEN_H - face->h;
 
+   /* Clean up. */
+   SDL_FreeSurface( face );
+
    /* Clear surface. */
    if (render_clearScreen())
       return -1;
@@ -812,6 +812,14 @@
    if (SDL_ATassert( "SDL_CreateTextureFromSurface", tface != 0))
       return -1;
 
+   /* Steps to take. */
+   ni     = SCREEN_W - FACE_W;
+   nj     = SCREEN_H - FACE_H;
+
+   /* Constant values. */
+   rect.w = face->w;
+   rect.h = face->h;
+
    /* Clean up. */
    SDL_FreeSurface( face );
 
@@ -820,14 +828,6 @@
    if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
       return -1;
 
-   /* Steps to take. */
-   ni     = SCREEN_W - FACE_W;
-   nj     = SCREEN_H - FACE_H;
-
-   /* Constant values. */
-   rect.w = face->w;
-   rect.h = face->h;
-
    /* Test None. */
    if (render_testBlitBlendMode( tface, SDL_BLENDMODE_NONE ))
       return -1;