diff options
author | Luiz Capitulino <lcapitulino@redhat.com> | 2012-07-20 13:30:18 -0300 |
---|---|---|
committer | Luiz Capitulino <lcapitulino@redhat.com> | 2012-08-13 13:19:52 -0300 |
commit | 2b38cf2e033d90fb50fc967f535935b170dc507d (patch) | |
tree | 1ac9ec5b947b22ceba04eea19d134458a1c40732 /qerror.c | |
parent | 5f0f0e13e1f714704d96f04050674c3102376409 (diff) | |
download | qemu-2b38cf2e033d90fb50fc967f535935b170dc507d.zip qemu-2b38cf2e033d90fb50fc967f535935b170dc507d.tar.gz qemu-2b38cf2e033d90fb50fc967f535935b170dc507d.tar.bz2 |
qerror: qerror_format(): return an allocated string
Simplifies current and future users.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'qerror.c')
-rw-r--r-- | qerror.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -493,9 +493,11 @@ static QString *qerror_format_desc(QDict *error, return qstring; } -QString *qerror_format(const char *fmt, QDict *error) +char *qerror_format(const char *fmt, QDict *error) { const QErrorStringTable *entry = NULL; + QString *qstr; + char *ret; int i; for (i = 0; qerror_table[i].error_fmt; i++) { @@ -505,7 +507,11 @@ QString *qerror_format(const char *fmt, QDict *error) } } - return qerror_format_desc(error, entry); + qstr = qerror_format_desc(error, entry); + ret = g_strdup(qstring_get_str(qstr)); + QDECREF(qstr); + + return ret; } /** |