diff options
Diffstat (limited to 'usr.sbin/smtpd/map.c')
-rw-r--r-- | usr.sbin/smtpd/map.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/usr.sbin/smtpd/map.c b/usr.sbin/smtpd/map.c index dba969a76a1..14aec231708 100644 --- a/usr.sbin/smtpd/map.c +++ b/usr.sbin/smtpd/map.c @@ -1,4 +1,4 @@ -/* $OpenBSD: map.c,v 1.17 2010/05/31 23:38:56 jacekm Exp $ */ +/* $OpenBSD: map.c,v 1.18 2010/06/01 19:47:09 jacekm Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -64,12 +64,13 @@ map_find(struct smtpd *env, objid_t id) void * map_lookup(struct smtpd *env, objid_t mapid, char *key, enum map_kind kind) { - void *hdl; - char *result, *tmp; + void *hdl = NULL; + char *result = NULL; + char *ret = NULL; size_t len; struct map *map; - struct map_backend *backend; - struct map_parser *parser; + struct map_backend *backend = NULL; + struct map_parser *parser = NULL; map = map_find(env, mapid); if (map == NULL) @@ -84,17 +85,16 @@ map_lookup(struct smtpd *env, objid_t mapid, char *key, enum map_kind kind) return NULL; } - result = backend->get(hdl, key, &len); - if (result == NULL) + ret = result = backend->get(hdl, key, &len); + if (ret == NULL) goto end; - if (parser->extract) { - tmp = result; - result = parser->extract(key, result, len); - free(tmp); + if (parser->extract != NULL) { + ret = parser->extract(key, result, len); + free(result); } end: backend->close(hdl); - return result; + return ret; } |