[pacman-dev] [PATCH] Fix memory leak in ALPM_EVENT_OPTDEP_REMOVAL callback

Allan McRae allan at archlinux.org
Sun Dec 21 14:02:40 UTC 2014


Signed-off-by: Allan McRae <allan at archlinux.org>
---
 src/pacman/callback.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/pacman/callback.c b/src/pacman/callback.c
index 4993382..d566d73 100644
--- a/src/pacman/callback.c
+++ b/src/pacman/callback.c
@@ -269,9 +269,11 @@ void cb_event(alpm_event_t *event)
 		case ALPM_EVENT_OPTDEP_REMOVAL:
 			{
 				alpm_event_optdep_removal_t *e = &event->optdep_removal;
+				char *dep_string = alpm_dep_compute_string(e->optdep);
 				colon_printf(_("%s optionally requires %s\n"),
 						alpm_pkg_get_name(e->pkg),
-						alpm_dep_compute_string(e->optdep));
+						dep_string);
+				free(dep_string);
 			}
 			break;
 		case ALPM_EVENT_DATABASE_MISSING:
-- 
2.2.0


More information about the pacman-dev mailing list