summaryrefslogtreecommitdiffstats
path: root/src/kiro-server.c
diff options
context:
space:
mode:
authorTimo Dritschler <timo.dritschler@kit.edu>2015-01-21 16:12:28 +0100
committerTimo Dritschler <timo.dritschler@kit.edu>2015-01-21 16:12:28 +0100
commitcac103dc4d9016cb07a2da991b3338a01a753b30 (patch)
treecf87e6e2d9d790e9327284806c23ccac662c9be7 /src/kiro-server.c
parent3cceb501d225b314a4f3188c32bd630cf306cd00 (diff)
downloadkiro-cac103dc4d9016cb07a2da991b3338a01a753b30.tar.gz
kiro-cac103dc4d9016cb07a2da991b3338a01a753b30.tar.bz2
kiro-cac103dc4d9016cb07a2da991b3338a01a753b30.tar.xz
kiro-cac103dc4d9016cb07a2da991b3338a01a753b30.zip
Fixed a bug in KiroClient when connection fails during setup
Added early-out functionality to all KIRO interfaces to prevent segfaults when passing a NULL pointer
Diffstat (limited to 'src/kiro-server.c')
-rw-r--r--src/kiro-server.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/kiro-server.c b/src/kiro-server.c
index ff6c0f8..fadc329 100644
--- a/src/kiro-server.c
+++ b/src/kiro-server.c
@@ -86,9 +86,7 @@ kiro_server_new (void)
void
kiro_server_free (KiroServer *server)
{
- if (!server)
- return;
-
+ g_return_if_fail (server != NULL);
if (KIRO_IS_SERVER (server))
g_object_unref (server);
else
@@ -99,6 +97,7 @@ kiro_server_free (KiroServer *server)
static void
kiro_server_init (KiroServer *self)
{
+ g_return_if_fail (self != NULL);
KiroServerPrivate *priv = KIRO_SERVER_GET_PRIVATE (self);
memset (priv, 0, sizeof (&priv));
}
@@ -107,6 +106,7 @@ kiro_server_init (KiroServer *self)
static void
kiro_server_finalize (GObject *object)
{
+ g_return_if_fail (object != NULL);
KiroServer *self = KIRO_SERVER (object);
//Clean up the server
kiro_server_stop (self);
@@ -118,6 +118,7 @@ kiro_server_finalize (GObject *object)
static void
kiro_server_class_init (KiroServerClass *klass)
{
+ g_return_if_fail (klass != NULL);
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = kiro_server_finalize;
g_type_class_add_private (klass, sizeof (KiroServerPrivate));
@@ -406,6 +407,7 @@ start_server_main_loop (gpointer data)
int
kiro_server_start (KiroServer *self, const char *address, const char *port, void *mem, size_t mem_size)
{
+ g_return_val_if_fail (self != NULL, -1);
KiroServerPrivate *priv = KIRO_SERVER_GET_PRIVATE (self);
if (priv->base) {
@@ -530,9 +532,7 @@ disconnect_client (gpointer data, gpointer user_data)
void
kiro_server_stop (KiroServer *self)
{
- if (!self)
- return;
-
+ g_return_if_fail (self != NULL);
KiroServerPrivate *priv = KIRO_SERVER_GET_PRIVATE (self);
if (!priv->base)