vty: show subscriber: put() before printing the use count
Do not show the VTY command's own use count during 'show subscriber <ID>'.
When using 'show subscriber msisdn 2023', I was surprised to see a use count of
2 and suspected a use count leak. With 'show subscriber cache' however, the use
count is 1.
So I realized it is the vty command's own use count that makes it two, besides
the lu_complete=true one.
Change-Id: Id02b57b7ed299b010b9f8b9e809548eb1e6aa699
diff --git a/src/libmsc/msc_vty.c b/src/libmsc/msc_vty.c
index 87adc82..4e71e26 100644
--- a/src/libmsc/msc_vty.c
+++ b/src/libmsc/msc_vty.c
@@ -832,10 +832,13 @@
return CMD_WARNING;
}
- subscr_dump_full_vty(vty, vsub);
-
+ /* In the vty output to the user, exclude this local use count added by vlr_subscr_get() in get_vsub_by_argv().
+ * This works, because: for get_vsub_by_argv() to succeed, there *must* have been at least one use count before
+ * this, and since this is not multi-threaded, this vlr_subscr_put() cannot possibly reach a count of 0. */
vlr_subscr_put(vsub);
+ subscr_dump_full_vty(vty, vsub);
+
return CMD_SUCCESS;
}