summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/map.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/smtpd/map.c')
-rw-r--r--usr.sbin/smtpd/map.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/usr.sbin/smtpd/map.c b/usr.sbin/smtpd/map.c
index 578fa134936..30bc42f09a2 100644
--- a/usr.sbin/smtpd/map.c
+++ b/usr.sbin/smtpd/map.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: map.c,v 1.19 2010/06/01 23:06:23 jacekm Exp $ */
+/* $OpenBSD: map.c,v 1.20 2010/10/09 22:05:35 gilles 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;
}