Revert "* Added valgrind memory leak tests in testmem.sh for restconf"

String error
This reverts commit 6e63f0a77b.
This commit is contained in:
Olof hagsand 2019-02-20 16:19:07 +01:00
parent 5b6bdbfd3a
commit a73d2bd242
29 changed files with 131 additions and 193 deletions

View file

@ -198,8 +198,4 @@ int clicon_xmldb_handle_set(clicon_handle h, void *xh);
char *clicon_username_get(clicon_handle h);
int clicon_username_set(clicon_handle h, void *username);
/* Set and get socket fd (ie backend server socket / restconf fcgx socket */
int clicon_socket_get(clicon_handle h);
int clicon_socket_set(clicon_handle h, int s);
#endif /* _CLIXON_OPTIONS_H_ */

View file

@ -66,17 +66,6 @@
* @note If you change here, you must also change the structs below:
* @see struct cli_handle
* @see struct backend_handle
* This is the internal definition of a "Clixon handle" which in its external
* form is "clicon_handle" and is used in most Clixon API calls.
* Some details:
* 1) the internal structure contains a header (defined here) whereas higher
* order libs (eg cli and backend) introduce more fields appended to this
* struct.
* 2) ch_options accessed via clicon_data() are clixon config options are
* string values appearing in the XML configfile accessed with -f.
* Alternatively, these could be accessed via clicon_conf_xml()
* 3) ch_data accessed via clicon_data() is more general purpose for any data.
* that is, not only strings. And has separate namespace from options.
*/
struct clicon_handle {
int ch_magic; /* magic (HDR) */

View file

@ -202,7 +202,7 @@ hash_value(clicon_hash_t *hash,
*
* @param[in] hash Hash table
* @param[in] key Variable name
* @param[in] val Variable value (pointer to)
* @param[in] val Variable value
* @param[in] vlen Length of variable value
* @retval variable New hash structure on success
* @retval NULL Failure

View file

@ -224,6 +224,7 @@ json_str_escape_cdata(cbuf *cb,
char *str)
{
int retval = -1;
char *snew = NULL;
int i;
int esc = 0; /* cdata escape */
@ -260,8 +261,12 @@ json_str_escape_cdata(cbuf *cb,
cprintf(cb, "%c", str[i]);
break;
}
if ((snew = strdup(cbuf_get(cb))) ==NULL){
clicon_err(OE_XML, errno, "strdup");
goto done;
}
retval = 0;
// done:
done:
return retval;
}

View file

@ -32,12 +32,7 @@
***** END LICENSE BLOCK *****
*
* This file contains access functions for two types of clixon vars:
* - options, ie string based variables from Clixon configuration files.
* Accessed with clicon_options(h).
* - data. Free-typed values for runtime getting and setting.
* Accessed with clicon_data(h).
* Consider splitting?
* CLICON options
*/
#ifdef HAVE_CONFIG_H
#include "clixon_config.h" /* generated by config & autoconf */
@ -364,8 +359,6 @@ clicon_option_str(clicon_handle h,
* @param[in] h clicon_handle
* @param[in] name option name
* @param[in] val option value, must be null-terminated string
* @retval 0 OK
* @retval -1 Error
*/
int
clicon_option_str_set(clicon_handle h,
@ -751,7 +744,7 @@ clicon_conf_xml(clicon_handle h)
return NULL;
}
/*! Set YANG specification for Clixon system options and features
/*! Set YANG specification for Clixon system options and features
* ys must be a malloced pointer
*/
int
@ -890,35 +883,3 @@ clicon_username_set(clicon_handle h,
}
/*! Get socket fd (ie backend server socket / restconf fcgx socket)
* @param[in] h Clicon handle
* @retval -1 No open socket
* @retval s Socket
*/
int
clicon_socket_get(clicon_handle h)
{
clicon_hash_t *cdat = clicon_data(h);
void *p;
if ((p = hash_value(cdat, "socket", NULL)) == NULL)
return -1;
return *(int*)p;
}
/*! Set socket fd (ie backend server socket / restconf fcgx socket)
* @param[in] h Clicon handle
* @param[in] s Open socket (or -1 to close)
* @retval 0 OK
* @retval -1 Error
*/
int
clicon_socket_set(clicon_handle h,
int s)
{
clicon_hash_t *cdat = clicon_data(h);
if (s == -1)
return hash_del(cdat, "socket");
return hash_add(cdat, "socket", &s, sizeof(int))==NULL?-1:0;
}