From 69860428696da413eebd785143b7c3c568918e0e Mon Sep 17 00:00:00 2001 From: Roland Dreier Date: Thu, 1 Jun 2006 05:41:41 +0000 Subject: [PATCH] Fix minor memory leaks The result of asprintf needs to be free when no longer needed. Signed-off-by: Roland Dreier --- ChangeLog | 3 +++ src/init.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index 5ecacf1..fe7c902 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2006-05-31 Roland Dreier + * src/init.c (find_drivers): Fix memory leak: the result of + asprintf() needs to be freed when we're done with it. + * examples/asyncwatch.c (event_name_str): Print human-readable form of IBV_EVENT_CLIENT_REREGISTER. diff --git a/src/init.c b/src/init.c index 1df5f17..04dfd9b 100644 --- a/src/init.c +++ b/src/init.c @@ -108,6 +108,8 @@ static void find_drivers(char *dir) asprintf(&pat, "%s/*.so", dir); ret = glob(pat, 0, NULL, &so_glob); + free(pat); + if (ret) { if (ret != GLOB_NOMATCH) fprintf(stderr, PFX "Warning: couldn't search %s\n", pat); -- 2.41.0