Commit ad4b2f37 authored by Mark Andrews's avatar Mark Andrews

1479. [bug] cfg_create_tuple() failed to handle out of

                        memory cleanup.  parse_list() would leak memory
                        on syntax errors.
parent 3425cd68
1479. [bug] cfg_create_tuple() failed to handle out of
memory cleanup. parse_list() would leak memory
on syntax errors.
1478. [port] ifconfig.sh didn't account for other virtual
interfaces. It now takes a optional arguement
to specify the first interface number. [RT #3907]
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: parser.c,v 1.109 2003/07/03 00:43:28 marka Exp $ */
/* $Id: parser.c,v 1.110 2003/07/03 01:50:25 marka Exp $ */
#include <config.h>
......@@ -216,7 +216,8 @@ cfg_create_tuple(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
return (ISC_R_SUCCESS);
cleanup:
CLEANUP_OBJ(obj);
if (obj != NULL)
isc_mem_put(pctx->mctx, obj, sizeof(*obj));
return (result);
}
......@@ -973,24 +974,26 @@ parse_list(cfg_parser_t *pctx, const cfg_type_t *listtype, cfg_obj_t **ret)
cfg_obj_t *listobj = NULL;
const cfg_type_t *listof = listtype->of;
isc_result_t result;
cfg_listelt_t *elt = NULL;
CHECK(cfg_create_list(pctx, listtype, &listobj));
for (;;) {
cfg_listelt_t *elt = NULL;
CHECK(cfg_peektoken(pctx, 0));
if (pctx->token.type == isc_tokentype_special &&
pctx->token.value.as_char == '}')
pctx->token.value.as_char == /*{*/ '}')
break;
CHECK(cfg_parse_listelt(pctx, listof, &elt));
CHECK(parse_semicolon(pctx));
ISC_LIST_APPEND(listobj->value.list, elt, link);
elt = NULL;
}
*ret = listobj;
return (ISC_R_SUCCESS);
cleanup:
if (elt != NULL)
free_list_elt(pctx, elt);
CLEANUP_OBJ(listobj);
return (result);
}
......@@ -1303,7 +1306,6 @@ parse_symtab_elt(cfg_parser_t *pctx, const char *name,
CHECK(isc_symtab_define(symtab, name,
1, symval,
isc_symexists_reject));
obj = NULL;
return (ISC_R_SUCCESS);
cleanup:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment