17 Jan
2012
17 Jan
'12
6:57 p.m.
From: "Richard W.M. Jones" <rjones@redhat.com> Don't leak old drv->device when add_drives is called multiple times. --- fish/options.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/fish/options.c b/fish/options.c index 48c8e1c..f652389 100644 --- a/fish/options.c +++ b/fish/options.c @@ -43,6 +43,9 @@ add_drives (struct drv *drv, char next_drive) if (drv) { next_drive = add_drives (drv->next, next_drive); + free (drv->device); + drv->device = NULL; + if (asprintf (&drv->device, "/dev/sd%c", next_drive) == -1) { perror ("asprintf"); exit (EXIT_FAILURE); -- 1.7.6