Commit 242b94ac270098d593c2f03ab21d8ff676c89e91

Pali Rohár 2019-07-24T23:06:57

Correctly process malloc() error in dlsym() malloc() may fail, so propagate this error to caller.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/dlfcn.c b/dlfcn.c
index ec60423..ce06d93 100644
--- a/dlfcn.c
+++ b/dlfcn.c
@@ -439,6 +439,11 @@ void *dlsym( void *handle, const char *name )
                 }
                 free( modules );
             }
+            else
+            {
+                SetLastError( ERROR_NOT_ENOUGH_MEMORY );
+                goto end;
+            }
         }
     }