Use GLib "return an allocated string generated by printf-style
authorGuy Harris <guy@alum.mit.edu>
Tue, 15 Jan 2013 23:36:48 +0000 (23:36 -0000)
committerGuy Harris <guy@alum.mit.edu>
Tue, 15 Jan 2013 23:36:48 +0000 (23:36 -0000)
formatting" routines and the corresponding deallocate routines.

svn path=/trunk/; revision=47106

wsutil/crash_info.c

index 7f09436e7c1739a73c286b1f154baa87e0b20a6c..3f892a10b9512a97ec3d223dbc6e4e80f7848d71 100644 (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);
        }
 }