evas: software_engine: free allocation on error path 29/226029/1
authorStefan Schmidt <s.schmidt@samsung.com>
Tue, 25 Feb 2020 09:57:24 +0000 (10:57 +0100)
committerJunsuChoi <jsuya.choi@samsung.com>
Wed, 26 Feb 2020 07:44:31 +0000 (16:44 +0900)
When we allocated s but fail to allocate l we need to make sure to free
the first allocation before erroring out.

CID: 1419874

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Differential Revision: https://phab.enlightenment.org/D11409

Change-Id: I4016c7bab0347519e03345f4bb46d16377479dc4

src/modules/evas/engines/software_generic/evas_engine.c

index d1e19c6..1b79f5a 100755 (executable)
@@ -5597,7 +5597,11 @@ evgl_glShaderSource(GLuint shader, GLsizei count, const char* const* string, con
    char **s = malloc(count * sizeof(char*));
    if (!s) goto err;
    GLint *l = malloc(count * sizeof(GLint));
-   if (!l) goto err;
+   if (!l)
+     {
+        free(s);
+        goto err;
+     }
 
    memset(s, 0, count * sizeof(char*));
    memset(l, 0, count * sizeof(GLint));