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

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2025-02-14T08:37:23+01:00

ctl: refactored error handling and removed unnecessary code

---

Modified: src/modules/ctl/fifo_server.c

---

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

---

diff --git a/src/modules/ctl/fifo_server.c b/src/modules/ctl/fifo_server.c
index 70ce92deb76..2d671798cce 100644
--- a/src/modules/ctl/fifo_server.c
+++ b/src/modules/ctl/fifo_server.c
@@ -1290,7 +1290,7 @@ static int rpc_struct_printf(struct text_chunk *c, char 
*name, char *fmt, ...)
                                        &nm, 1); /* Escape all characters, 
including : and , */
                        if(!m) {
                                rpc_fault(ctx, 500, "Internal Server Error");
-                               goto err;
+                               goto error;
                        }
 
                        s.s = buf;
@@ -1300,7 +1300,7 @@ static int rpc_struct_printf(struct text_chunk *c, char 
*name, char *fmt, ...)
                                rpc_fault(ctx, 500, "Internal Server Error");
                                free_chunk(m);
                                ERR("Error while creating text_chunk 
structure");
-                               goto err;
+                               goto error;
                        }
 
                        l->flags |= CHUNK_MEMBER_VALUE;
@@ -1326,13 +1326,12 @@ static int rpc_struct_printf(struct text_chunk *c, char 
*name, char *fmt, ...)
                if((buf0 = ctl_realloc(buf, buf_size)) == 0) {
                        rpc_fault(ctx, 500, "Internal Server Error (No memory 
left)");
                        ERR("No memory left\n");
-                       goto err;
+                       goto error;
                }
                buf = buf0;
        }
-       ctl_free(buf);
-       return 0;
-err:
+
+error:
        if(buf)
                ctl_free(buf);
        return -1;

_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to