osmith has uploaded this change for review.

View Change

gtp/gsn: gtp_new: replace calloc with talloc_zero

Prepare to attach allocate an internal struct in the next patch, that
will be attached to *gsn's talloc tree.

Change-Id: Ie10dd6f32a42513f6d2b5c7dd0dd84b4f0d20afb
---
M gtp/gsn.c
1 file changed, 20 insertions(+), 2 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/71/36071/1
diff --git a/gtp/gsn.c b/gtp/gsn.c
index c23fb2a..8cb1a47 100644
--- a/gtp/gsn.c
+++ b/gtp/gsn.c
@@ -116,6 +116,12 @@
{}
};

+static void *gsn_ctx = NULL;
+
+static __attribute__((constructor)) void on_dso_load_init_ctx(void)
+{
+ gsn_ctx = talloc_named_const(NULL, 1, "libgtp gsn.c");
+}

/* API Functions */

@@ -466,7 +472,7 @@
{
LOGP(DLGTP, LOGL_NOTICE, "GTP: gtp_newgsn() started at %s\n", inet_ntoa(*listen));

- *gsn = calloc(sizeof(struct gsn_t), 1); /* TODO */
+ *gsn = talloc_zero(gsn_ctx, struct gsn_t);

(*gsn)->statedir = statedir;
log_restart(*gsn);
@@ -550,7 +556,7 @@

rate_ctr_group_free(gsn->ctrg);

- free(gsn);
+ talloc_free(gsn);
return 0;
}


To view, visit change 36071. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: Ie10dd6f32a42513f6d2b5c7dd0dd84b4f0d20afb
Gerrit-Change-Number: 36071
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith@sysmocom.de>
Gerrit-MessageType: newchange