Memory leaks
This commit is contained in:
parent
0ef0970c04
commit
585823a609
5 changed files with 27 additions and 7 deletions
|
|
@ -121,6 +121,7 @@ backend_terminate(clicon_handle h)
|
|||
ys_free(yspec);
|
||||
if ((nsctx = clicon_nsctx_global_get(h)) != NULL)
|
||||
cvec_free(nsctx);
|
||||
clicon_data_cvec_del(h, "netconf-statistics");
|
||||
if ((x = clicon_nacm_ext(h)) != NULL)
|
||||
xml_free(x);
|
||||
if ((x = clicon_conf_xml(h)) != NULL)
|
||||
|
|
|
|||
|
|
@ -256,6 +256,7 @@ restconf_proto2str(int proto)
|
|||
}
|
||||
|
||||
/*! Return media_in from Content-Type, -1 if not found or unrecognized
|
||||
*
|
||||
* @note media-type syntax does not support parameters
|
||||
* @see RFC7231 Sec 3.1.1.1 for media-type syntax type:
|
||||
* media-type = type "/" subtype *( OWS ";" OWS parameter )
|
||||
|
|
@ -277,6 +278,7 @@ restconf_content_type(clicon_handle h)
|
|||
}
|
||||
|
||||
/*! Translate http header by capitalizing, prepend w HTTP_ and - -> _
|
||||
*
|
||||
* Example: Host -> HTTP_HOST
|
||||
*/
|
||||
int
|
||||
|
|
@ -316,6 +318,7 @@ restconf_convert_hdr(clicon_handle h,
|
|||
}
|
||||
|
||||
/*! Parse a cookie string and return value of cookie attribute
|
||||
*
|
||||
* @param[in] cookiestr cookie string according to rfc6265 (modified)
|
||||
* @param[in] attribute cookie attribute
|
||||
* @param[out] val malloced cookie value, free with free()
|
||||
|
|
@ -343,6 +346,7 @@ get_user_cookie(char *cookiestr,
|
|||
}
|
||||
|
||||
/*! Clean and close all state of restconf process (but dont exit).
|
||||
*
|
||||
* Cannot use h after this
|
||||
* @param[in] h Clixon handle
|
||||
*/
|
||||
|
|
@ -486,7 +490,7 @@ restconf_insert_attributes(cxobj *xdata,
|
|||
}
|
||||
|
||||
/*! Callback for yang extensions ietf-restconf:yang-data
|
||||
* @see ietf-restconf.yang
|
||||
*
|
||||
* @param[in] h Clixon handle
|
||||
* @param[in] yext Yang node of extension
|
||||
* @param[in] ys Yang node of (unknown) statement belonging to extension
|
||||
|
|
@ -499,6 +503,7 @@ restconf_insert_attributes(cxobj *xdata,
|
|||
* - The available identity values for any 'identityref'
|
||||
* leaf or leaf-list nodes are limited to the module containing this extension statement and
|
||||
* the modules imported into that module.
|
||||
* @see ietf-restconf.yang
|
||||
*/
|
||||
int
|
||||
restconf_main_extension_cb(clicon_handle h,
|
||||
|
|
@ -560,6 +565,7 @@ restconf_uripath(clicon_handle h)
|
|||
}
|
||||
|
||||
/*! Drop privileges from root to user (or already at user)
|
||||
*
|
||||
* @param[in] h Clicon handle
|
||||
* Group set to CLICON_SOCK_GROUP to communicate with backend
|
||||
*/
|
||||
|
|
@ -642,9 +648,9 @@ restconf_drop_privileges(clicon_handle h)
|
|||
* @param[in] req Generic Www handle (can be part of clixon handle)
|
||||
* @param[in] pretty Pretty-print
|
||||
* @param[in] media_out Restconf output media
|
||||
* @retval -1 Error
|
||||
* @retval 0 Not authenticated
|
||||
* @retval 1 Authenticated
|
||||
* @retval 0 Not authenticated
|
||||
* @retval -1 Error
|
||||
*/
|
||||
int
|
||||
restconf_authentication_cb(clicon_handle h,
|
||||
|
|
@ -727,11 +733,12 @@ restconf_authentication_cb(clicon_handle h,
|
|||
}
|
||||
|
||||
/*! Basic config init, set auth-type, pretty, etc
|
||||
*
|
||||
* @param[in] h Clixon handle
|
||||
* @param[in] xrestconf XML config containing clixon-restconf top-level
|
||||
* @retval -1 Error
|
||||
* @retval 0 Restconf is disable
|
||||
* @retval 1 OK
|
||||
* @retval 0 Restconf is disable
|
||||
* @retval -1 Error
|
||||
*/
|
||||
int
|
||||
restconf_config_init(clicon_handle h,
|
||||
|
|
@ -809,7 +816,6 @@ restconf_config_init(clicon_handle h,
|
|||
goto done;
|
||||
}
|
||||
|
||||
|
||||
/*! Create and bind restconf socket
|
||||
*
|
||||
* @param[in] netns0 Network namespace, special value "default" is same as NULL
|
||||
|
|
|
|||
|
|
@ -180,6 +180,7 @@
|
|||
static int session_id_context = 1;
|
||||
|
||||
/*! Set restconf native handle
|
||||
*
|
||||
* @param[in] h Clicon handle
|
||||
* @param[in] rh Restconf native handle (malloced pointer)
|
||||
*/
|
||||
|
|
@ -321,6 +322,7 @@ alpn_proto_dump(const char *label,
|
|||
}
|
||||
|
||||
/*! Application-layer Protocol Negotiation (alpn) callback
|
||||
*
|
||||
* The value of the out, outlen vector should be set to the value of a single protocol selected from
|
||||
* the in, inlen vector. The out buffer may point directly into in, or to a buffer that outlives the
|
||||
* handshake.
|
||||
|
|
@ -524,6 +526,7 @@ restconf_checkcert_file(cxobj *xrestconf,
|
|||
}
|
||||
|
||||
/*! Accept new socket client
|
||||
*
|
||||
* @param[in] fd Socket (unix or ip)
|
||||
* @param[in] arg typecast clicon_handle
|
||||
* @see openssl_init_socket where this callback is registered
|
||||
|
|
@ -565,6 +568,10 @@ restconf_accept_client(int fd,
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (rsock->rs_from_addr != NULL){
|
||||
free(rsock->rs_from_addr);
|
||||
rsock->rs_from_addr = NULL;
|
||||
}
|
||||
if ((rsock->rs_from_addr = calloc(INET6_ADDRSTRLEN, 1)) == NULL){
|
||||
clicon_err(OE_UNIX, errno, "calloc");
|
||||
goto done;
|
||||
|
|
@ -635,6 +642,7 @@ restconf_native_terminate(clicon_handle h)
|
|||
}
|
||||
|
||||
/*! Query backend of config.
|
||||
*
|
||||
* Loop to wait for backend starting, try again if not done
|
||||
* @param[in] h Clixon handle
|
||||
* @param[out] xrestconf XML restconf config, malloced (if retval = 1)
|
||||
|
|
@ -705,6 +713,7 @@ restconf_clixon_backend(clicon_handle h,
|
|||
}
|
||||
|
||||
/*! Per-socket openssl inits
|
||||
*
|
||||
* @param[in] h Clicon handle
|
||||
* @param[in] xs XML config of single restconf socket
|
||||
* @param[in] nsc Namespace context
|
||||
|
|
@ -893,6 +902,7 @@ restconf_openssl_init(clicon_handle h,
|
|||
}
|
||||
|
||||
/*! Read restconf from config
|
||||
*
|
||||
* After SEVERAL iterations the code now does as follows:
|
||||
* - init clixon
|
||||
* - look for local config (in clixon-config file)
|
||||
|
|
@ -1069,6 +1079,7 @@ restconf_clixon_init(clicon_handle h,
|
|||
}
|
||||
|
||||
/*! Signal terminates process
|
||||
*
|
||||
* Just set exit flag for proper exit in event loop
|
||||
*/
|
||||
static void
|
||||
|
|
@ -1088,6 +1099,7 @@ restconf_sig_term(int arg)
|
|||
}
|
||||
|
||||
/*! Usage help routine
|
||||
*
|
||||
* @param[in] argv0 command line
|
||||
* @param[in] h Clicon handle
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ typedef struct restconf_socket{
|
|||
* Set in restconf_callhome_cb
|
||||
*/
|
||||
restconf_conn *rs_conns; /* List of transient connect sockets */
|
||||
char *rs_from_addr; /* From IP address as seen by accept */
|
||||
char *rs_from_addr; /* From IP address as seen by accept (mv to rc?) */
|
||||
|
||||
} restconf_socket;
|
||||
|
||||
|
|
|
|||
|
|
@ -130,6 +130,7 @@ case $release in
|
|||
;;
|
||||
freebsd)
|
||||
# packages for building
|
||||
$sshcmd sudo pkg upgrade -y
|
||||
$sshcmd sudo pkg install -y git gmake bash
|
||||
# cligen
|
||||
$sshcmd sudo pkg install -y bison flex
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue