|
@@ -1025,7 +1025,7 @@ static int rpc_add(struct binrpc_ctx *ctx, char *fmt, ...)
|
|
|
int err;
|
|
|
str st;
|
|
|
str *sp;
|
|
|
- struct rpc_struct_l *rs;
|
|
|
+ struct rpc_struct_l *rs = NULL;
|
|
|
str null_value = str_init("<null string>");
|
|
|
double d;
|
|
|
|
|
@@ -1069,12 +1069,14 @@ static int rpc_add(struct binrpc_ctx *ctx, char *fmt, ...)
|
|
|
if(err < 0)
|
|
|
goto error_add;
|
|
|
rs = new_rpc_struct();
|
|
|
- if(rs == 0)
|
|
|
+ if(rs == NULL)
|
|
|
goto error_mem;
|
|
|
rs->offset = binrpc_pkt_len(&ctx->out.pkt);
|
|
|
err = binrpc_end_struct(&ctx->out.pkt);
|
|
|
- if(err < 0)
|
|
|
+ if(err < 0) {
|
|
|
+ ctl_free(rs);
|
|
|
goto error_add;
|
|
|
+ }
|
|
|
clist_append(&ctx->out.structs, rs, next, prev);
|
|
|
*(va_arg(ap, void **)) = rs;
|
|
|
break;
|
|
@@ -1180,7 +1182,7 @@ static int rpc_struct_add(struct rpc_struct_l *s, char *fmt, ...)
|
|
|
va_list ap;
|
|
|
int err;
|
|
|
struct binrpc_val avp;
|
|
|
- struct rpc_struct_l *rs;
|
|
|
+ struct rpc_struct_l *rs = NULL;
|
|
|
str *sp;
|
|
|
str null_value = str_init("<null string>");
|
|
|
|
|
@@ -1226,7 +1228,7 @@ static int rpc_struct_add(struct rpc_struct_l *s, char *fmt, ...)
|
|
|
goto error_add;
|
|
|
}
|
|
|
rs = new_rpc_struct();
|
|
|
- if(rs == 0) {
|
|
|
+ if(rs == NULL) {
|
|
|
LM_ERR("not enough memory (%c)\n", *fmt);
|
|
|
goto error_mem;
|
|
|
}
|
|
@@ -1234,6 +1236,7 @@ static int rpc_struct_add(struct rpc_struct_l *s, char *fmt, ...)
|
|
|
err = binrpc_end_struct(&s->pkt);
|
|
|
if(err < 0) {
|
|
|
LM_ERR("failed to end struct (%c)\n", *fmt);
|
|
|
+ ctl_free(rs);
|
|
|
goto error_add;
|
|
|
}
|
|
|
clist_append(&s->substructs, rs, next, prev);
|
|
@@ -1289,8 +1292,8 @@ static int rpc_array_add(struct rpc_struct_l *s, char *fmt, ...)
|
|
|
va_list ap;
|
|
|
int err;
|
|
|
str st;
|
|
|
- str *sp;
|
|
|
- struct rpc_struct_l *rs;
|
|
|
+ str *sp = NULL;
|
|
|
+ struct rpc_struct_l *rs = NULL;
|
|
|
str null_value = str_init("<null string>");
|
|
|
double d;
|
|
|
|
|
@@ -1334,12 +1337,14 @@ static int rpc_array_add(struct rpc_struct_l *s, char *fmt, ...)
|
|
|
if(err < 0)
|
|
|
goto error_add;
|
|
|
rs = new_rpc_struct();
|
|
|
- if(rs == 0)
|
|
|
+ if(rs == NULL)
|
|
|
goto error_mem;
|
|
|
rs->offset = binrpc_pkt_len(&s->pkt);
|
|
|
err = binrpc_end_struct(&s->pkt);
|
|
|
- if(err < 0)
|
|
|
+ if(err < 0) {
|
|
|
+ ctl_free(rs);
|
|
|
goto error_add;
|
|
|
+ }
|
|
|
clist_append(&s->substructs, rs, next, prev);
|
|
|
*(va_arg(ap, void **)) = rs;
|
|
|
break;
|