gweb: Check GString pointers before freeing them
authorMohamed Abbas <mabbas@linux.intel.com>
Tue, 25 Jan 2011 22:17:37 +0000 (14:17 -0800)
committerSamuel Ortiz <sameo@linux.intel.com>
Tue, 25 Jan 2011 23:41:55 +0000 (00:41 +0100)
Fixes BMC#12452

gweb/gweb.c

index 5de108365c2c7c1c01f9b42aa3251502a45868c3..7387e7c3d8bc59b74d49827bbb77bd463705a7e3 100644 (file)
@@ -151,10 +151,16 @@ static void free_session(struct web_session *session)
                g_io_channel_unref(session->transport_channel);
 
        g_free(session->result.last_key);
-       g_hash_table_destroy(session->result.headers);
 
-       g_string_free(session->send_buffer, TRUE);
-       g_string_free(session->current_header, TRUE);
+       if (session->result.headers != NULL)
+               g_hash_table_destroy(session->result.headers);
+
+       if (session->send_buffer != NULL)
+               g_string_free(session->send_buffer, TRUE);
+
+       if (session->current_header != NULL)
+               g_string_free(session->current_header, TRUE);
+
        g_free(session->receive_buffer);
 
        g_free(session->content_type);