[Frugalware-git] frugalwareutils: libfwyabootcfg.c: Fix some memleaks

Priyank priyank at frugalware.org
Sun Jan 4 20:40:24 CET 2009


Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=frugalwareutils.git;a=commitdiff;h=d8e9883ce9adca422517d7dcb9c2fe8f1c9d729a

commit d8e9883ce9adca422517d7dcb9c2fe8f1c9d729a
Author: Priyank <priyank at frugalware.org>
Date:   Mon Jan 5 01:10:19 2009 +0530

libfwyabootcfg.c: Fix some memleaks

diff --git a/libfwyabootcfg/libfwyabootcfg.c b/libfwyabootcfg/libfwyabootcfg.c
index 6407270..691b890 100644
--- a/libfwyabootcfg/libfwyabootcfg.c
+++ b/libfwyabootcfg/libfwyabootcfg.c
@@ -218,15 +218,22 @@ static void os_prober(FILE *fp)
void fwyaboot_create_menu(FILE *fp, int flags)
{
char *root = find_root();
+	char *ptr = NULL;

fprintf(fp, "#\n"
"# /etc/yaboot.conf - configuration file for Yaboot\n"
"# This file is generated automatically by yabootcfg\n"
"#\n\n");
-	fprintf(fp, "init-message=\"%s\"\n", gen_title());
+	ptr = gen_title();
+	fprintf(fp, "init-message=\"%s\"\n", ptr);
+	FWUTIL_FREE (ptr);
fprintf(fp, "boot=%s\n", find_boot());
-	fprintf(fp, "device=%s\n", of_path(root, 0));
-	fprintf(fp, "partition=%s\n", of_path(root, 1));
+	ptr = of_path(root, 0);
+	fprintf(fp, "device=%s\n", ptr);
+	FWUTIL_FREE (ptr);
+	ptr = of_path(root, 1);
+	fprintf(fp, "partition=%s\n", ptr);
+	FWUTIL_FREE (ptr);
fprintf(fp, "delay=10\n"
"timeout=40\n"
"install=/usr/lib/yaboot/yaboot\n"


More information about the Frugalware-git mailing list