]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- remove malloc from inplace_cb_register
authorRalph Dolmans <ralph@nlnetlabs.nl>
Thu, 6 Apr 2017 13:41:49 +0000 (13:41 +0000)
committerRalph Dolmans <ralph@nlnetlabs.nl>
Thu, 6 Apr 2017 13:41:49 +0000 (13:41 +0000)
git-svn-id: file:///svn/unbound/trunk@4095 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
edns-subnet/subnetmod.c
util/module.c
util/module.h

index 447584a4a6ec1c982085a148560b437b6a3594df..b376c5353b30427c6d299493ab1f55b71fd17012 100644 (file)
@@ -8,6 +8,7 @@
        - Removed extern ECS config options
        - module_restart_next now calls clear on all following modules
        - Also create ECS module qstate on module_event_pass event
+       - remove malloc from inplace_cb_register
 
 6 April 2017: Wouter
        - Small fixup for documentation.
index f403f74e2a99a8fe4a88e95a5035131ac959de85..c29b7907ea79cdf580afdac2193483176dfe49d1 100644 (file)
@@ -224,9 +224,9 @@ subnetmod_init(struct module_env *env, int id)
                return 0;
        }
        inplace_cb_register((void*)ecs_whitelist_check, inplace_cb_query, NULL,
-               0, env, id);
+               env, id);
        inplace_cb_register((void*)ecs_edns_back_parsed,
-               inplace_cb_edns_back_parsed, NULL, 0, env, id);
+               inplace_cb_edns_back_parsed, NULL, env, id);
        lock_rw_init(&sn_env->biglock);
        return 1;
 }
index da93ad31c9188489d20f8a396f261ebfaf2e76fa..421a8487039c4a1c20770d955e3b1e8168ce4499 100644 (file)
@@ -125,7 +125,7 @@ edns_register_option(uint16_t opt_code, int bypass_cache_stage,
 
 int
 inplace_cb_register(void* cb, enum inplace_cb_list_type type, void* cbarg,
-       size_t cbarg_len, struct module_env* env, int id)
+       struct module_env* env, int id)
 {
        struct inplace_cb* callback;
        struct inplace_cb** prevp;
@@ -143,15 +143,6 @@ inplace_cb_register(void* cb, enum inplace_cb_list_type type, void* cbarg,
        callback->id = id;
        callback->next = NULL;
        callback->cb = cb;
-       if(cbarg) {
-               if(!(callback->cb_arg = calloc(1, cbarg_len))){
-                       log_err("out of memory during edns callback argument"
-                               "registration.");
-                       free(callback);
-                       return 0;
-               }
-               memcpy(callback->cb_arg, cbarg, cbarg_len);
-       }
        
        prevp = (struct inplace_cb**) &env->inplace_cb_lists[type];
        /* append at end of list */
index dc6ba2b8d01598adfc3248776162a8c2f7013abf..f9360b53a77a327d5a1e91c5af5b321b45a495c8 100644 (file)
@@ -696,7 +696,6 @@ int edns_register_option(uint16_t opt_code, int bypass_cache_stage,
  * @param cb: pointer to the callback function.
  * @param type: inplace callback type.
  * @param cbarg: argument for the callback function, or NULL.
- * @param cbarg_len: size of cbars, or 0.
  * @param env: the module environment.
  * @param id: module id.
  * @return true on success, false on failure (out of memory or trying to
@@ -704,7 +703,7 @@ int edns_register_option(uint16_t opt_code, int bypass_cache_stage,
  */
 int
 inplace_cb_register(void* cb, enum inplace_cb_list_type type, void* cbarg,
-       size_t cbarg_len, struct module_env* env, int id);
+       struct module_env* env, int id);
 
 /**
  * Delete callback for specified type and module id.