THRIFT-4376: fix a few high impact coverity defects:
1458947: memory leak in compiler
1458787: resource leak in c_glib led to discovery of assert() abuse
1459090: fix string.find result check in JSON processor (unlikely)

This closes #1404
diff --git a/lib/c_glib/test/testframedtransport.c b/lib/c_glib/test/testframedtransport.c
index d50ff23..0328737 100755
--- a/lib/c_glib/test/testframedtransport.c
+++ b/lib/c_glib/test/testframedtransport.c
@@ -17,7 +17,6 @@
  * under the License.
  */
 
-#include <assert.h>
 #include <netdb.h>
 #include <sys/wait.h>
 
@@ -42,7 +41,7 @@
 
   GObject *object = NULL;
   object = g_object_new (THRIFT_TYPE_FRAMED_TRANSPORT, NULL);
-  assert (object != NULL);
+  g_assert (object != NULL);
   g_object_get (G_OBJECT (object), "transport", &transport,
                 "r_buf_size", &r_buf_size,
                 "w_buf_size", &w_buf_size, NULL);
@@ -65,9 +64,9 @@
                             "transport", THRIFT_TRANSPORT (tsocket), NULL);
 
   /* this shouldn't work */
-  assert (thrift_framed_transport_open (transport, NULL) == FALSE);
-  assert (thrift_framed_transport_is_open (transport) == TRUE);
-  assert (thrift_framed_transport_close (transport, NULL) == TRUE);
+  g_assert (thrift_framed_transport_open (transport, NULL) == FALSE);
+  g_assert (thrift_framed_transport_is_open (transport) == TRUE);
+  g_assert (thrift_framed_transport_close (transport, NULL) == TRUE);
   g_object_unref (transport);
   g_object_unref (tsocket);
 
@@ -79,7 +78,7 @@
   transport = g_object_new (THRIFT_TYPE_FRAMED_TRANSPORT,
                             "transport", THRIFT_TRANSPORT (tsocket), NULL);
 
-  assert (thrift_framed_transport_open (transport, &err) == FALSE);
+  g_assert (thrift_framed_transport_open (transport, &err) == FALSE);
   g_object_unref (transport);
   g_object_unref (tsocket);
   g_error_free (err);
@@ -97,7 +96,7 @@
   guchar buf[10] = TEST_DATA; /* a buffer */
 
   pid = fork ();
-  assert ( pid >= 0 );
+  g_assert ( pid >= 0 );
 
   if ( pid == 0 )
   {
@@ -114,8 +113,8 @@
                               "transport", THRIFT_TRANSPORT (tsocket),
                               "w_buf_size", 4, NULL);
 
-    assert (thrift_framed_transport_open (transport, NULL) == TRUE);
-    assert (thrift_framed_transport_is_open (transport));
+    g_assert (thrift_framed_transport_open (transport, NULL) == TRUE);
+    g_assert (thrift_framed_transport_is_open (transport));
 
     /* write 10 bytes */
     thrift_framed_transport_write (transport, buf, 10, NULL);
@@ -137,8 +136,8 @@
     g_object_unref (transport);
     g_object_unref (tsocket);
 
-    assert ( wait (&status) == pid );
-    assert ( status == 0 );
+    g_assert ( wait (&status) == pid );
+    g_assert ( status == 0 );
   }
 }
 
@@ -247,12 +246,12 @@
   client = g_object_new (THRIFT_TYPE_FRAMED_TRANSPORT, "transport",
                          thrift_server_transport_accept (transport, NULL),
                          "r_buf_size", 5, NULL);
-  assert (client != NULL);
+  g_assert (client != NULL);
 
   /* read 10 bytes */
   bytes = thrift_framed_transport_read (client, buf, 10, NULL);
-  assert (bytes == 10); /* make sure we've read 10 bytes */
-  assert ( memcmp (buf, match, 10) == 0 ); /* make sure what we got matches */
+  g_assert (bytes == 10); /* make sure we've read 10 bytes */
+  g_assert ( memcmp (buf, match, 10) == 0 ); /* make sure what we got matches */
 
   bytes = thrift_framed_transport_read (client, buf, 6, NULL);
   bytes = thrift_framed_transport_read (client, buf, 5, NULL);