On 04 Apr 2016, at 15:30, msuraev(a)sysmocom.de wrote:
Hi Max,
+const char *bsc_nat_resolve_path(void *ctx, const
char *base, const char *name)
+{
+ return ('/' == name[0]) ? name : talloc_asprintf(ctx, "%s/%s", base,
+ name);
+}
I had hinted to you to repeat config reload (and relative paths) and observing memory
consumption by using top -p `pidof osmo-bsc_nat`.
This routine is problematic either way in C.
Semantic:
Sometimes new memory will be allocated sometimes not
Responsibility:
Sometimes the callers needs to call talloc_free, sometimes not.
Result:
a.) Caller will never call talloc_free => sometimes leaks
b.) Caller will always call talloc_free => sometimes crashes
Solution:
Make the semantic consistent
So please, take this leak and make yourself familiar with valgrind, talloc leak check,
etc. It is important to learn from it. See my previous mail for an example how to script
it.
kind regards
holger