diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2015-05-19 18:04:26 -0700 |
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2015-05-19 18:04:26 -0700 |
| commit | 24873f0c06e6196a105f648e8fe29d19dcddd1de (patch) | |
| tree | f0ad6ae52390a9ed3b63c6fe228da30f5cf92d7b /lib/distribute.c | |
| parent | 0299c0042783463ee007a6dba0de70dcf6fc36ee (diff) | |
lib: lib-warnings.patch
Remove compile warnings for the lib directory
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by:
Diffstat (limited to 'lib/distribute.c')
| -rw-r--r-- | lib/distribute.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/distribute.c b/lib/distribute.c index ba8043cf9e..7157d9a5be 100644 --- a/lib/distribute.c +++ b/lib/distribute.c @@ -69,10 +69,11 @@ distribute_lookup (const char *ifname) struct distribute *dist; /* temporary reference */ - key.ifname = (char *)ifname; + key.ifname = XSTRDUP(MTYPE_DISTRIBUTE_IFNAME, ifname); dist = hash_lookup (disthash, &key); - + XFREE(MTYPE_DISTRIBUTE_IFNAME, key.ifname); + return dist; } @@ -106,11 +107,15 @@ static struct distribute * distribute_get (const char *ifname) { struct distribute key; + struct distribute *ret; /* temporary reference */ - key.ifname = (char *)ifname; + key.ifname = XSTRDUP(MTYPE_DISTRIBUTE_IFNAME, ifname); - return hash_get (disthash, &key, (void * (*) (void *))distribute_hash_alloc); + ret = hash_get (disthash, &key, (void * (*) (void *))distribute_hash_alloc); + + XFREE(MTYPE_DISTRIBUTE_IFNAME, key.ifname); + return ret; } static unsigned int |
