Commit cea65639741360465fc1bd19c889d2dac0d99971

Mars Cheng 2020-03-24T20:05:29

fix memory leak in dlsym()

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/dlfcn.c b/dlfcn.c
index 2497a39..01e878b 100644
--- a/dlfcn.c
+++ b/dlfcn.c
@@ -432,7 +432,10 @@ void *dlsym( void *handle, const char *name )
                             continue;
                         symbol = GetProcAddress( modules[i], name );
                         if( symbol != NULL )
+                        {
+                            free( modules );
                             goto end;
+                        }
                     }
 
                 }