[Title] Fixed memory leaks in fastpath module
authorHaegeun Park <haegeun.park@samsung.com>
Mon, 26 Aug 2013 07:21:51 +0000 (00:21 -0700)
committerHaegeun Park <haegeun.park@samsung.com>
Mon, 26 Aug 2013 07:21:51 +0000 (00:21 -0700)
[Issue#]
[Problem]
[Cause] Definitely lost recorded in valgrind
[Solution]

src/modules/fastpath/coregl_fastpath.c
src/modules/fastpath/coregl_fastpath_gl.c

index 99a472e..1414e4c 100644 (file)
@@ -471,6 +471,13 @@ fastpath_remove_context_states_from_list(GLContextState *cstate, Mutex *mtx)
                                glctx_list = current->next;
                                nextitm = glctx_list;
                        }
+                       if (current->option != NULL)
+                       {
+                               AST(current->option_len > 0);
+                               free(current->option);
+                               current->option = NULL;
+                               current->option_len = 0;
+                       }
                        free(current);
                        ret = 1;
                        current = nextitm;
index b4d88fa..2e0d819 100644 (file)
@@ -201,12 +201,12 @@ _detach_program_object(GL_Shared_Object_State *sostate, GLuint real_object, int
                        int i;
                        for (i = 0; i < poat->shader_count; i++)
                        {
-                               GLuint glue_shader = fastpath_sostate_find_object(sostate, GL_OBJECT_TYPE_PROGRAM, poat->shaders[i]);
-                               fastpath_sostate_remove_object(sostate, GL_OBJECT_TYPE_PROGRAM, glue_shader);
+                               AST(is_program == 1);
+                               _detach_program_object(sostate, poat->shaders[i], 0, 0);
                        }
 
-                       poat = NULL;
                        free(poat);
+                       poat = NULL;
 
                        if (is_program == 1)
                                _orig_fastpath_glDeleteProgram(real_object);