1474. [port] Provide strtoul() and memmove() for platforms
without them.
-1473. [bug] free_map() and free_string() failed to handle out
+1473. [bug] create_map() and create_string() failed to handle out
of memory cleanup. [RT #6813]
1472. [contrib] idnkit-1.0 from JPNIC, replaces mdnkit.
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: parser.c,v 1.108 2003/06/20 02:50:48 marka Exp $ */
+/* $Id: parser.c,v 1.109 2003/07/03 00:43:28 marka Exp $ */
#include <config.h>
obj->value.string.length = len;
obj->value.string.base = isc_mem_get(pctx->mctx, len + 1);
if (obj->value.string.base == 0) {
- CLEANUP_OBJ(obj);
+ isc_mem_put(pctx->mctx, obj, sizeof(*obj));
return (ISC_R_NOMEMORY);
}
memcpy(obj->value.string.base, contents, len);
static void
free_string(cfg_parser_t *pctx, cfg_obj_t *obj) {
- if (obj->value.string.base != NULL)
- isc_mem_put(pctx->mctx, obj->value.string.base,
- obj->value.string.length + 1);
+ isc_mem_put(pctx->mctx, obj->value.string.base,
+ obj->value.string.length + 1);
}
isc_boolean_t
return (ISC_R_SUCCESS);
cleanup:
- CLEANUP_OBJ(obj);
+ if (obj != NULL)
+ isc_mem_put(pctx->mctx, obj, sizeof(*obj));
return (result);
}
static void
free_map(cfg_parser_t *pctx, cfg_obj_t *obj) {
- if (obj->value.map.id != NULL)
- CLEANUP_OBJ(obj->value.map.id);
+ CLEANUP_OBJ(obj->value.map.id);
isc_symtab_destroy(&obj->value.map.symtab);
}