Module: kamailio
Branch: master
Commit: 93011f8292c568f67bf5127ae7e092ec773df1a7
URL: 
https://github.com/kamailio/kamailio/commit/93011f8292c568f67bf5127ae7e092ec773df1a7

Author: Pantelis Kolatsis <[email protected]>
Committer: Henning Westerholt <[email protected]>
Date: 2023-03-29T11:34:50Z

misctest: convert to memory logging helper

---

Modified: src/modules/misctest/misctest_mod.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/93011f8292c568f67bf5127ae7e092ec773df1a7.diff
Patch: 
https://github.com/kamailio/kamailio/commit/93011f8292c568f67bf5127ae7e092ec773df1a7.patch

---

diff --git a/src/modules/misctest/misctest_mod.c 
b/src/modules/misctest/misctest_mod.c
index e0108b5a76b..575bc618e8b 100644
--- a/src/modules/misctest/misctest_mod.c
+++ b/src/modules/misctest/misctest_mod.c
@@ -244,7 +244,11 @@ static int misctest_memory_init(void)
 {
        alloc_lst = shm_malloc(sizeof(*alloc_lst));
        if(alloc_lst == 0)
+       {
+               SHM_MEM_ERROR;
                goto error;
+       }
+
        alloc_lst->chunks = 0;
        atomic_set_long(&alloc_lst->size, 0);
        atomic_set_int(&alloc_lst->no, 0);
@@ -252,7 +256,10 @@ static int misctest_memory_init(void)
                goto error;
        rndt_lst = shm_malloc(sizeof(*rndt_lst));
        if(rndt_lst == 0)
+       {
+               SHM_MEM_ERROR;
                goto error;
+       }
        rndt_lst->tests = 0;
        atomic_set_int(&rndt_lst->last_id, 0);
        if(lock_init(&rndt_lst->lock) == 0)
@@ -469,7 +476,10 @@ static int mem_track(void *addr, unsigned long size)
 
        mc = shm_malloc(sizeof(*mc));
        if(mc == 0)
+       {
+               SHM_MEM_ERROR;
                goto error;
+       }
        mc->addr = addr;
        mc->size = size;
        mc->flags = 0;
@@ -782,7 +792,10 @@ static int mem_leak_time_test(unsigned long min, unsigned 
long max,
 
        tst = shm_malloc(sizeof(*tst));
        if(tst == 0)
+       {
+               SHM_MEM_ERROR;
                goto error;
+       }
        memset(tst, 0, sizeof(*tst));
        id = tst->id = atomic_add_int(&rndt_lst->last_id, 1);
        tst->min = min;

_______________________________________________
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to [email protected]

Reply via email to