X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fwidget-io.c;h=73a7301662033e366a1d8180692c131646b82aac;hb=b0a85a90ec68578d775a8cf5161c8e3ad9d35241;hp=e64719907f8ecb910f62efabd2e6604cc9ce6524;hpb=1abba60b3018ce7eb3d85930ad591e4d6ad39813;p=pspp diff --git a/src/ui/gui/widget-io.c b/src/ui/gui/widget-io.c index e64719907f..73a7301662 100644 --- a/src/ui/gui/widget-io.c +++ b/src/ui/gui/widget-io.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2007 Free Software Foundation + Copyright (C) 2007, 2009, 2011 Free Software Foundation This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,6 +26,7 @@ #include +#include "xalloc.h" /* Create a GtkLabel and pack it into BOX. The label is created using part of the string at S, and the directives @@ -90,7 +91,7 @@ widget_printf (const gchar *fmt, ...) if ( 0 != printf_parse (fmt, &d, &a) ) return NULL; - widgets = calloc (sizeof (*widgets), d.count); + widgets = xcalloc (sizeof (*widgets), d.count); va_start (ap, fmt); for (i = 0 ; i < d.count ; ++i ) { @@ -99,7 +100,8 @@ widget_printf (const gchar *fmt, ...) } va_end (ap); - g_free (a.arg); + if (a.arg != a.direct_alloc_arg) + free (a.arg); output = g_string_sized_new (strlen (fmt)); @@ -127,7 +129,8 @@ widget_printf (const gchar *fmt, ...) } free (widgets); - free (d.dir); + if (d.dir != d.direct_alloc_dir) + free (d.dir); if (*s) g_string_append_len (output, s, -1); @@ -161,7 +164,8 @@ widget_scanf (const gchar *fmt, ...) if ( 0 != printf_parse (fmt, &d, &a) ) return NULL; - g_free (a.arg); + if (a.arg != a.direct_alloc_arg) + free (a.arg); va_start (ap, fmt); @@ -231,7 +235,8 @@ widget_scanf (const gchar *fmt, ...) g_free (widgets); - free (d.dir); + if (d.dir != d.direct_alloc_dir) + free (d.dir); return hbox; }