[evolution-ews] Clean up and fix leak in ews_oab_read_upto()
- From: David Woodhouse <dwmw2 src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-ews] Clean up and fix leak in ews_oab_read_upto()
- Date: Tue, 11 Jun 2013 14:50:33 +0000 (UTC)
commit 7ad9aae781cec80f4e3463030324ea89a2467bac
Author: David Woodhouse <David Woodhouse intel com>
Date: Mon Jun 10 23:41:31 2013 +0100
Clean up and fix leak in ews_oab_read_upto()
src/addressbook/ews-oab-decoder.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/addressbook/ews-oab-decoder.c b/src/addressbook/ews-oab-decoder.c
index 7727dac..c6c53b5 100644
--- a/src/addressbook/ews-oab-decoder.c
+++ b/src/addressbook/ews-oab-decoder.c
@@ -383,14 +383,16 @@ ews_oab_read_upto (GInputStream *is,
GString *str;
str = g_string_sized_new (size);
- do {
+ while (1) {
gsize len;
gsize bytes_read;
gchar *c = g_malloc0 (size);
- g_input_stream_read_all (is, c, size, &bytes_read, cancellable, error);
- if (*error)
+ if (!g_input_stream_read_all (is, c, size, &bytes_read,
+ cancellable, error)) {
+ g_free (c);
break;
+ }
if (bytes_read != size)
size = bytes_read;
@@ -399,6 +401,8 @@ ews_oab_read_upto (GInputStream *is,
if (len)
str = g_string_append_len (str, c, len);
+ g_free (c);
+
if (len == 0 || len < size) {
goffset seek = (goffset) len + 1 - (goffset) size;
@@ -408,8 +412,7 @@ ews_oab_read_upto (GInputStream *is,
}
size *= 2;
- g_free (c);
- } while (!*error);
+ }
return g_string_free (str, FALSE);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]