summaryrefslogtreecommitdiff
path: root/src/trg-client.c
diff options
context:
space:
mode:
authorGravatar Alan Fitton <ajf@eth0.org.uk>2012-01-12 08:40:24 +0000
committerGravatar Alan Fitton <ajf@eth0.org.uk>2012-01-12 08:40:24 +0000
commit19ad0589a0aefc571271decc45296974bb9fdba5 (patch)
treea7c352f5d5e11b29e5e6c86d810bb23cd6b7b9ad /src/trg-client.c
parent41a8f63ce28e228611d72156abb39d496691d8be (diff)
fix memory leak on response from first response from server (HTTP conflict with session id).
Diffstat (limited to 'src/trg-client.c')
-rw-r--r--src/trg-client.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/trg-client.c b/src/trg-client.c
index 42237ff..a2c09b8 100644
--- a/src/trg-client.c
+++ b/src/trg-client.c
@@ -620,13 +620,15 @@ trg_response *dispatch_str(TrgClient * client, gchar * req)
trg_http_perform(client, req, response);
g_free(req);
- if (response->status != CURLE_OK)
- return response;
+ if (response->status == CURLE_OK)
+ response->obj = trg_deserialize(response, &decode_error);
- response->obj = trg_deserialize(response, &decode_error);
g_free(response->raw);
response->raw = NULL;
+ if (response->status != CURLE_OK)
+ return response;
+
if (decode_error) {
g_error("JSON decoding error: %s", decode_error->message);
g_error_free(decode_error);