{
const char *dir = HACK_CONFIGURATION_PATH;
int L = strlen (dir);
- char *file = (char *) malloc (L + strlen (program) + 10);
+ char *file;
char *s;
FILE *f;
- conf_data *data = (conf_data *) calloc (1, sizeof(*data));
+ conf_data *data;
+
+ if (L == 0) return 0;
+
+ file = (char *) malloc (L + strlen (program) + 10);
+ data = (conf_data *) calloc (1, sizeof(*data));
strcpy (file, dir);
if (file[L-1] != '/')
fprintf (stderr, "%s: reading %s...\n", blurb(), file);
res = fread (chars, 1, 4, f);
- if (res <= 0) return 0;
+ if (res <= 0)
+ {
+ free (data);
+ data = 0;
+ goto DONE;
+ }
ctxt = xmlCreatePushParserCtxt(NULL, NULL, chars, res, file);
while ((res = fread(chars, 1, size, f)) > 0)
}
data->progname = strdup (program);
+
+ DONE:
+ free (file);
return data;
}
gtk_widget_destroy (data->widget);
if (data->progname)
- free (data->progname);;
+ free (data->progname);
+ if (data->description)
+ free (data->description);
memset (data, ~0, sizeof(*data));
free (data);