Fix derefrencing of NULL pointer
[platform/upstream/connman.git] / src / ippool.c
old mode 100644 (file)
new mode 100755 (executable)
index cea1dcc..f2e9b00
@@ -28,7 +28,6 @@
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
-#include <sys/errno.h>
 #include <sys/socket.h>
 
 #include "connman.h"
@@ -43,8 +42,6 @@ struct address_info {
 };
 
 struct connman_ippool {
-       unsigned int refcount;
-
        struct address_info *info;
 
        char *gateway;
@@ -65,30 +62,11 @@ static uint32_t block_20_bits;
 static uint32_t block_24_bits;
 static uint32_t subnet_mask_24;
 
-struct connman_ippool *
-__connman_ippool_ref_debug(struct connman_ippool *pool,
-                               const char *file, int line, const char *caller)
-{
-       DBG("%p ref %d by %s:%d:%s()", pool, pool->refcount + 1,
-               file, line, caller);
-
-       __sync_fetch_and_add(&pool->refcount, 1);
-
-       return pool;
-}
-
-void __connman_ippool_unref_debug(struct connman_ippool *pool,
-                               const char *file, int line, const char *caller)
+void __connman_ippool_free(struct connman_ippool *pool)
 {
        if (!pool)
                return;
 
-       DBG("%p ref %d by %s:%d:%s()", pool, pool->refcount - 1,
-               file, line, caller);
-
-       if (__sync_fetch_and_sub(&pool->refcount, 1) != 1)
-               return;
-
        if (pool->info) {
                allocated_blocks = g_slist_remove(allocated_blocks, pool->info);
                g_free(pool->info);
@@ -386,7 +364,6 @@ struct connman_ippool *__connman_ippool_create(int index,
        info->start = block;
        info->end = block + range;
 
-       pool->refcount = 1;
        pool->info = info;
        pool->collision_cb = collision_cb;
        pool->user_data = user_data;