memleaks
This commit is contained in:
parent
b894c30bfb
commit
deb89600ed
23 changed files with 50 additions and 31 deletions
|
|
@ -531,6 +531,8 @@ from_client_unlock(clicon_handle h,
|
||||||
ok:
|
ok:
|
||||||
retval = 0;
|
retval = 0;
|
||||||
done:
|
done:
|
||||||
|
if (cbx)
|
||||||
|
cbuf_free(cbx);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -333,6 +333,8 @@ validate_identityref(cxobj *xt,
|
||||||
}
|
}
|
||||||
retval = 0;
|
retval = 0;
|
||||||
done:
|
done:
|
||||||
|
if (cb)
|
||||||
|
cbuf_free(cb);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -326,6 +326,10 @@ xp_eval_step(xp_ctx *xc0,
|
||||||
if (cxvec_append(xp, &xc->xc_nodeset, &xc->xc_size) < 0)
|
if (cxvec_append(xp, &xc->xc_nodeset, &xc->xc_size) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
if (vec){
|
||||||
|
free(vec);
|
||||||
|
vec = NULL;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case A_PRECEEDING:
|
case A_PRECEEDING:
|
||||||
break;
|
break;
|
||||||
|
|
@ -1080,8 +1084,10 @@ xpath_vec_ctx(cxobj *xcur,
|
||||||
goto done;
|
goto done;
|
||||||
if (xp_eval(&xc, xy.xy_top, xrp) < 0)
|
if (xp_eval(&xc, xy.xy_top, xrp) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (xc.xc_nodeset)
|
if (xc.xc_nodeset){
|
||||||
free(xc.xc_nodeset);
|
free(xc.xc_nodeset);
|
||||||
|
xc.xc_nodeset = NULL;
|
||||||
|
}
|
||||||
/* done: */
|
/* done: */
|
||||||
xpath_parse_exit(&xy);
|
xpath_parse_exit(&xy);
|
||||||
xpath_scan_exit(&xy);
|
xpath_scan_exit(&xy);
|
||||||
|
|
|
||||||
|
|
@ -1616,7 +1616,6 @@ yang_parse_str(char *str,
|
||||||
yy.yy_parse_string = str;
|
yy.yy_parse_string = str;
|
||||||
yy.yy_stack = NULL;
|
yy.yy_stack = NULL;
|
||||||
yy.yy_module = NULL; /* this is the return value - the module/sub-module */
|
yy.yy_module = NULL; /* this is the return value - the module/sub-module */
|
||||||
|
|
||||||
if (ystack_push(&yy, (yang_node*)yspec) == NULL)
|
if (ystack_push(&yy, (yang_node*)yspec) == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
if (strlen(str)){ /* Not empty */
|
if (strlen(str)){ /* Not empty */
|
||||||
|
|
@ -1640,6 +1639,8 @@ yang_parse_str(char *str,
|
||||||
ymod = yy.yy_module;
|
ymod = yy.yy_module;
|
||||||
done:
|
done:
|
||||||
ystack_pop(&yy);
|
ystack_pop(&yy);
|
||||||
|
if (yy.yy_stack)
|
||||||
|
free (yy.yy_stack);
|
||||||
return ymod; /* top-level (sub)module */
|
return ymod; /* top-level (sub)module */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2281,7 +2282,7 @@ ys_parse(yang_stmt *ys,
|
||||||
* That is, siblings, etc, may not be there. Complete checks are made in
|
* That is, siblings, etc, may not be there. Complete checks are made in
|
||||||
* ys_populate instead.
|
* ys_populate instead.
|
||||||
* @param[in] ys yang statement
|
* @param[in] ys yang statement
|
||||||
* @param[in] extra Yang extra for cornercases (unknown/extension)
|
* @param[in] extra Yang extra for cornercases (unknown/extension).
|
||||||
*
|
*
|
||||||
* The cv:s created in parse-tree as follows:
|
* The cv:s created in parse-tree as follows:
|
||||||
* fraction-digits : Create cv as uint8, check limits [1:8] (must be made in 1st pass)
|
* fraction-digits : Create cv as uint8, check limits [1:8] (must be made in 1st pass)
|
||||||
|
|
@ -2335,7 +2336,6 @@ ys_parse_sub(yang_stmt *ys,
|
||||||
clicon_err(OE_YANG, errno, "Parsing CV: %s", reason);
|
clicon_err(OE_YANG, errno, "Parsing CV: %s", reason);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
free(extra);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -343,8 +343,9 @@ unknown_stmt : ustring ':' ustring ';'
|
||||||
}
|
}
|
||||||
| ustring ':' ustring ' ' string ';'
|
| ustring ':' ustring ' ' string ';'
|
||||||
{ char *id; if ((id=prefix_id_join($1, $3)) == NULL) _YYERROR("0");
|
{ char *id; if ((id=prefix_id_join($1, $3)) == NULL) _YYERROR("0");
|
||||||
if (ysp_add(_yy, Y_UNKNOWN, id, $5) == NULL) _YYERROR("0");
|
if (ysp_add(_yy, Y_UNKNOWN, id, $5) == NULL){ _YYERROR("0"); }
|
||||||
clicon_debug(2,"unknown-stmt -> ustring : ustring string");
|
clicon_debug(2,"unknown-stmt -> ustring : ustring string");
|
||||||
|
if ($5) free($5);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ fi
|
||||||
|
|
||||||
new "start backend -s init -f $cfg -y $fyang"
|
new "start backend -s init -f $cfg -y $fyang"
|
||||||
# start new backend
|
# start new backend
|
||||||
sudo clixon_backend -s init -f $cfg -y $fyang
|
sudo $clixon_backend -s init -f $cfg -y $fyang
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err
|
err
|
||||||
fi
|
fi
|
||||||
|
|
@ -195,6 +195,7 @@ expecteq "$(curl -u guest:bar -sS -X PUT -d '{"x": 3}' http://localhost/restconf
|
||||||
new "Kill restconf daemon"
|
new "Kill restconf daemon"
|
||||||
sudo pkill -u www-data clixon_restconf
|
sudo pkill -u www-data clixon_restconf
|
||||||
|
|
||||||
|
new "Kill backend"
|
||||||
pid=`pgrep clixon_backend`
|
pid=`pgrep clixon_backend`
|
||||||
if [ -z "$pid" ]; then
|
if [ -z "$pid" ]; then
|
||||||
err "backend already dead"
|
err "backend already dead"
|
||||||
|
|
|
||||||
|
|
@ -169,17 +169,18 @@ sudo clixon_backend -zf $cfg -y $fyang
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err
|
err
|
||||||
fi
|
fi
|
||||||
|
sleep 1
|
||||||
new "start backend -s init -f $cfg -y $fyang"
|
new "start backend -s init -f $cfg -y $fyang"
|
||||||
# start new backend
|
# start new backend
|
||||||
sudo clixon_backend -s init -f $cfg -y $fyang
|
sudo $clixon_backend -s init -f $cfg -y $fyang
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err
|
err
|
||||||
fi
|
fi
|
||||||
|
sleep 1
|
||||||
|
|
||||||
new "kill old restconf daemon"
|
new "kill old restconf daemon"
|
||||||
sudo pkill -u www-data clixon_restconf
|
sudo pkill -u www-data clixon_restconf
|
||||||
sleep 1
|
|
||||||
new "start restconf daemon (-a is enable http basic auth)"
|
new "start restconf daemon (-a is enable http basic auth)"
|
||||||
sudo start-stop-daemon -S -q -o -b -x /www-data/clixon_restconf -d /www-data -c www-data -- -f $cfg -y $fyang -- -a
|
sudo start-stop-daemon -S -q -o -b -x /www-data/clixon_restconf -d /www-data -c www-data -- -f $cfg -y $fyang -- -a
|
||||||
|
|
||||||
|
|
@ -246,6 +247,7 @@ expectfn "$clixon_cli -1 -U guest -l o -f $cfg -y $fyang rpc ipv4" 255 "protocol
|
||||||
new "Kill restconf daemon"
|
new "Kill restconf daemon"
|
||||||
sudo pkill -u www-data clixon_restconf
|
sudo pkill -u www-data clixon_restconf
|
||||||
|
|
||||||
|
new "Kill backend"
|
||||||
pid=`pgrep clixon_backend`
|
pid=`pgrep clixon_backend`
|
||||||
if [ -z "$pid" ]; then
|
if [ -z "$pid" ]; then
|
||||||
err "backend already dead"
|
err "backend already dead"
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ if [ $? -ne 0 ]; then
|
||||||
fi
|
fi
|
||||||
new "start backend -s init -f $cfg"
|
new "start backend -s init -f $cfg"
|
||||||
sudo $clixon_backend -s init -f $cfg
|
sudo $clixon_backend -s init -f $cfg
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err
|
err
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ if [ $? -ne 0 ]; then
|
||||||
fi
|
fi
|
||||||
new "start backend -s init -f $cfg -y $fyang"
|
new "start backend -s init -f $cfg -y $fyang"
|
||||||
# start new backend
|
# start new backend
|
||||||
sudo clixon_backend -s init -f $cfg -y $fyang # -D 1
|
sudo $clixon_backend -s init -f $cfg -y $fyang # -D 1
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err
|
err
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,15 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Test: JSON parser tests
|
# Test: JSON parser tests
|
||||||
|
#PROG="valgrind --leak-check=full --show-leak-kinds=all ../util/clixon_util_json"
|
||||||
PROG=../util/clixon_util_json
|
PROG=../util/clixon_util_json
|
||||||
|
|
||||||
# include err() and new() functions and creates $dir
|
# include err() and new() functions and creates $dir
|
||||||
. ./lib.sh
|
. ./lib.sh
|
||||||
|
|
||||||
new "json parse"
|
new "json parse"
|
||||||
expecteof $PROG 0 '{"foo": -23}' "^<foo>-23</foo>$"
|
expecteof "$PROG" 0 '{"foo": -23}' "^<foo>-23</foo>$"
|
||||||
|
|
||||||
new "json parse list"
|
new "json parse list"
|
||||||
expecteof $PROG 0 '{"a":[0,1,2,3]}' "^<a>0</a><a>1</a><a>2</a><a>3</a>$"
|
expecteof "$PROG" 0 '{"a":[0,1,2,3]}' "^<a>0</a><a>1</a><a>2</a><a>3</a>$"
|
||||||
|
|
||||||
rm -rf $dir
|
rm -rf $dir
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ fi
|
||||||
|
|
||||||
new "start backend -s init -f $cfg -y $fyang"
|
new "start backend -s init -f $cfg -y $fyang"
|
||||||
# start new backend
|
# start new backend
|
||||||
sudo clixon_backend -s init -f $cfg -y $fyang
|
sudo $clixon_backend -s init -f $cfg -y $fyang
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err
|
err
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ fi
|
||||||
|
|
||||||
new "start backend -s init -f $cfg -y $fyang"
|
new "start backend -s init -f $cfg -y $fyang"
|
||||||
# start new backend
|
# start new backend
|
||||||
sudo clixon_backend -s init -f $cfg -y $fyang
|
sudo $clixon_backend -s init -f $cfg -y $fyang
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err
|
err
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ if [ $? -ne 0 ]; then
|
||||||
fi
|
fi
|
||||||
new "start backend -s init -f $cfg -y $fyang"
|
new "start backend -s init -f $cfg -y $fyang"
|
||||||
# start new backend
|
# start new backend
|
||||||
sudo clixon_backend -s init -f $cfg -y $fyang # -D 1
|
sudo $clixon_backend -s init -f $cfg -y $fyang # -D 1
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err
|
err
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ fi
|
||||||
|
|
||||||
new "start backend"
|
new "start backend"
|
||||||
# start new backend
|
# start new backend
|
||||||
sudo clixon_backend -s running -f $cfg -y $fyang
|
sudo $clixon_backend -s running -f $cfg -y $fyang
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err
|
err
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ fi
|
||||||
|
|
||||||
new "start backend -s init -f $cfg -y $fyang"
|
new "start backend -s init -f $cfg -y $fyang"
|
||||||
# start new backend
|
# start new backend
|
||||||
sudo clixon_backend -s init -f $cfg -y $fyang
|
sudo $clixon_backend -s init -f $cfg -y $fyang
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err
|
err
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ if [ $? -ne 0 ]; then
|
||||||
err
|
err
|
||||||
fi
|
fi
|
||||||
new "start backend -s init -f $cfg -y $fyang"
|
new "start backend -s init -f $cfg -y $fyang"
|
||||||
sudo clixon_backend -s init -f $cfg -y $fyang # -D 1
|
sudo $clixon_backend -s init -f $cfg -y $fyang # -D 1
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err
|
err
|
||||||
fi
|
fi
|
||||||
|
|
@ -291,7 +291,6 @@ fi
|
||||||
|
|
||||||
# Cant get shell macros to work, inline matching from lib.sh
|
# Cant get shell macros to work, inline matching from lib.sh
|
||||||
|
|
||||||
|
|
||||||
new "Kill restconf daemon"
|
new "Kill restconf daemon"
|
||||||
sudo pkill -u www-data clixon_restconf
|
sudo pkill -u www-data clixon_restconf
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,8 @@ if [ $? -ne 0 ]; then
|
||||||
err
|
err
|
||||||
fi
|
fi
|
||||||
new "start backend -s init -f $cfg -y $fyang"
|
new "start backend -s init -f $cfg -y $fyang"
|
||||||
sudo clixon_backend -s init -f $cfg -y $fyang
|
sudo $clixon_backend -s init -f $cfg -y $fyang
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err
|
err
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ if [ $? -ne 0 ]; then
|
||||||
err
|
err
|
||||||
fi
|
fi
|
||||||
new "start backend -s init -f $cfg -y $fyang"
|
new "start backend -s init -f $cfg -y $fyang"
|
||||||
sudo clixon_backend -s init -f $cfg -y $fyang
|
sudo $clixon_backend -s init -f $cfg -y $fyang
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err
|
err
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ fi
|
||||||
|
|
||||||
new "start backend -s init -f $cfg -y $fyang"
|
new "start backend -s init -f $cfg -y $fyang"
|
||||||
# start new backend
|
# start new backend
|
||||||
sudo clixon_backend -s init -f $cfg -y $fyang
|
sudo $clixon_backend -s init -f $cfg -y $fyang
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err
|
err
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Test: XML parser tests
|
# Test: XML parser tests
|
||||||
|
#PROG="valgrind --leak-check=full --show-leak-kinds=all ../util/clixon_util_xml"
|
||||||
PROG=../util/clixon_util_xml
|
PROG=../util/clixon_util_xml
|
||||||
|
|
||||||
# include err() and new() functions and creates $dir
|
# include err() and new() functions and creates $dir
|
||||||
. ./lib.sh
|
. ./lib.sh
|
||||||
|
|
||||||
new "xml parse"
|
new "xml parse"
|
||||||
expecteof $PROG 0 "<a><b/></a>" "^<a><b/></a>$"
|
expecteof "$PROG" 0 "<a><b/></a>" "^<a><b/></a>$"
|
||||||
|
|
||||||
XML=$(cat <<EOF
|
XML=$(cat <<EOF
|
||||||
<a><description>An example of escaped CENDs</description>
|
<a><description>An example of escaped CENDs</description>
|
||||||
|
|
@ -24,7 +25,7 @@ XML=$(cat <<EOF
|
||||||
EOF
|
EOF
|
||||||
)
|
)
|
||||||
new "xml CDATA"
|
new "xml CDATA"
|
||||||
expecteof $PROG 0 "$XML" "^<a><description>An example of escaped CENDs</description><sometext>
|
expecteof "$PROG" 0 "$XML" "^<a><description>An example of escaped CENDs</description><sometext>
|
||||||
<![CDATA[ They're saying \"x < y\" & that \"z > y\" so I guess that means that z > x ]]>
|
<![CDATA[ They're saying \"x < y\" & that \"z > y\" so I guess that means that z > x ]]>
|
||||||
</sometext><data><![CDATA[This text contains a CEND ]]]]><![CDATA[>]]></data><alternative><![CDATA[This text contains a CEND ]]]><![CDATA[]>]]></alternative></a>$"
|
</sometext><data><![CDATA[This text contains a CEND ]]]]><![CDATA[>]]></data><alternative><![CDATA[This text contains a CEND ]]]><![CDATA[]>]]></alternative></a>$"
|
||||||
|
|
||||||
|
|
@ -33,14 +34,14 @@ XML=$(cat <<EOF
|
||||||
EOF
|
EOF
|
||||||
)
|
)
|
||||||
new "xml encode <>&"
|
new "xml encode <>&"
|
||||||
expecteof $PROG 0 "$XML" "^$XML$"
|
expecteof "$PROG" 0 "$XML" "^$XML$"
|
||||||
|
|
||||||
XML=$(cat <<EOF
|
XML=$(cat <<EOF
|
||||||
<message>To allow attribute values to contain both single and double quotes, the apostrophe or single-quote character ' may be represented as ' and the double-quote character as " </message>
|
<message>To allow attribute values to contain both single and double quotes, the apostrophe or single-quote character ' may be represented as ' and the double-quote character as " </message>
|
||||||
EOF
|
EOF
|
||||||
)
|
)
|
||||||
new "xml optional encode single and double quote"
|
new "xml optional encode single and double quote"
|
||||||
expecteof $PROG 0 "$XML" "^<message>To allow attribute values to contain both single and double quotes, the apostrophe or single-quote character ' may be represented as ' and the double-quote character as \"</message>$"
|
expecteof "$PROG" 0 "$XML" "^<message>To allow attribute values to contain both single and double quotes, the apostrophe or single-quote character ' may be represented as ' and the double-quote character as \"</message>$"
|
||||||
|
|
||||||
rm -rf $dir
|
rm -rf $dir
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Test: XPATH tests
|
# Test: XPATH tests
|
||||||
|
#PROG="valgrind --leak-check=full --show-leak-kinds=all ../util/clixon_util_xpath"
|
||||||
PROG=../util/clixon_util_xpath
|
PROG=../util/clixon_util_xpath
|
||||||
|
|
||||||
# include err() and new() functions and creates $dir
|
# include err() and new() functions and creates $dir
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ fi
|
||||||
|
|
||||||
new "start backend -s init -f $cfg -y $fyang"
|
new "start backend -s init -f $cfg -y $fyang"
|
||||||
# start new backend
|
# start new backend
|
||||||
sudo clixon_backend -s init -f $cfg -y $fyang
|
sudo $clixon_backend -s init -f $cfg -y $fyang
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err
|
err
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Test: XML parser tests
|
# Test: XML parser tests
|
||||||
|
#PROG="valgrind --leak-check=full --show-leak-kinds=all ../util/clixon_util_yang"
|
||||||
PROG=../util/clixon_util_yang
|
PROG=../util/clixon_util_yang
|
||||||
|
|
||||||
# include err() and new() functions and creates $dir
|
# include err() and new() functions and creates $dir
|
||||||
|
|
@ -12,13 +13,13 @@ module test{
|
||||||
description "Example from RFC 6020";
|
description "Example from RFC 6020";
|
||||||
argument "name";
|
argument "name";
|
||||||
}
|
}
|
||||||
ex:not-defined ARGUMENT;
|
ex:not-defined ARGUMENT;;
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
)
|
)
|
||||||
|
|
||||||
new "yang parse"
|
new "yang parse"
|
||||||
expecteof $PROG 0 "$YANG" "^$YANG$"
|
expecteof "$PROG" 0 "$YANG" "^$YANG$"
|
||||||
|
|
||||||
rm -rf $dir
|
rm -rf $dir
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue