Use GLib "return an allocated string generated by printf-style

formatting" routines and the corresponding deallocate routines.

svn path=/trunk/; revision=47106
This commit is contained in:
Guy Harris 2013-01-15 23:36:48 +00:00
parent 92b524bb1c
commit 111f8ea2bb
1 changed files with 4 additions and 4 deletions

View File

@ -147,16 +147,16 @@ ws_add_crash_info(const char *fmt, ...)
char *m, *old_info, *new_info;
va_start(ap, fmt);
vasprintf(&m, fmt, ap);
m = g_strdup_vprintf(fmt, ap);
va_end(ap);
if (__crashreporter_info__ == NULL)
__crashreporter_info__ = m;
else {
old_info = __crashreporter_info__;
asprintf(&new_info, "%s\n%s", old_info, m);
free(m);
new_info = g_strdup_printf("%s\n%s", old_info, m);
g_free(m);
__crashreporter_info__ = new_info;
free(old_info);
g_free(old_info);
}
}