summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/afb-api-v3.c3
-rw-r--r--src/afb-config.c30
2 files changed, 6 insertions, 27 deletions
diff --git a/src/afb-api-v3.c b/src/afb-api-v3.c
index 1bda6b08..02853b12 100644
--- a/src/afb-api-v3.c
+++ b/src/afb-api-v3.c
@@ -239,6 +239,9 @@ void afb_api_v3_unref(struct afb_api_v3 *api)
{
if (api && !__atomic_sub_fetch(&api->refcount, 1, __ATOMIC_RELAXED)) {
afb_export_destroy(api->export);
+ while (api->count)
+ free(api->verbs[--api->count]);
+ free(api->verbs);
free(api);
}
}
diff --git a/src/afb-config.c b/src/afb-config.c
index 3c0d28e9..a791969f 100644
--- a/src/afb-config.c
+++ b/src/afb-config.c
@@ -396,30 +396,6 @@ static void printHelp(FILE * file, const char *name)
name);
}
-/*---------------------------------------------------------
- | helpers for argument scanning
- +--------------------------------------------------------- */
-
-static const char *current_argument(int optid)
-{
- if (optarg == 0) {
- ERROR("option [--%s] needs a value i.e. --%s=xxx",
- name_of_optid(optid), name_of_optid(optid));
- exit(1);
- }
- return optarg;
-}
-
-static char *argvalstr(int optid)
-{
- char *result = strdup(current_argument(optid));
- if (result == NULL) {
- ERROR("can't alloc memory");
- exit(1);
- }
- return result;
-}
-
/**********************************
* json helpers
***********************************/
@@ -584,9 +560,9 @@ static void config_add_optstr(struct json_object *config, int optid)
| set the log levels
+--------------------------------------------------------- */
-static void set_log(char *args)
+static void set_log(const char *args)
{
- char o = 0, s, *p, *i = args;
+ char o = 0, s, *p, *i = strdupa(args);
int lvl;
for(;;) switch (*i) {
@@ -653,7 +629,7 @@ static void parse_arguments_inner(int argc, char **argv, struct json_object *con
break;
case SET_LOG:
- set_log(argvalstr(optid));
+ set_log(get_arg(optid));
break;
case SET_PORT: