OSDN Git Service

Fix memory leak in dlopen()/dlclose().
authorPhilip Craig <philipjcraig@gmail.com>
Tue, 8 Feb 2011 06:11:38 +0000 (16:11 +1000)
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Fri, 11 Feb 2011 18:30:17 +0000 (19:30 +0100)
The linked list of library dependencies created by dlopen() was not
being freed by dlclose().

Signed-off-by: Philip Craig <philipjcraig@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
ldso/libdl/libdl.c

index b88bc48..ee5cd44 100644 (file)
@@ -922,6 +922,10 @@ static int do_dlclose(void *vhandle, int need_fini)
                        free(tpnt);
                }
        }
+       for (rpnt1 = handle->next; rpnt1; rpnt1 = rpnt1_tmp) {
+               rpnt1_tmp = rpnt1->next;
+               free(rpnt1);
+       }
        free(handle->init_fini.init_fini);
        free(handle);