diff options
author | manoj <manoj@13f79535-47bb-0310-9956-ffa450edef68> | 1999-11-05 21:26:29 +0000 |
---|---|---|
committer | manoj <manoj@13f79535-47bb-0310-9956-ffa450edef68> | 1999-11-05 21:26:29 +0000 |
commit | ec2c46867cf7154c5c5280df2c0ae23c928278c7 (patch) | |
tree | de4866cb6216d19219bc71e1b026f4b4cbdef2fb /misc | |
parent | 134bb8768fda1747c83f4788b930ff12b1a14063 (diff) | |
download | libapr-ec2c46867cf7154c5c5280df2c0ae23c928278c7.tar.gz |
Plug some memory leaks, and eliminate a little redundant code.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@59457 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'misc')
-rw-r--r-- | misc/beos/start.c | 9 | ||||
-rw-r--r-- | misc/win32/start.c | 9 |
2 files changed, 4 insertions, 14 deletions
diff --git a/misc/beos/start.c b/misc/beos/start.c index 597cf968e..f6ca03b73 100644 --- a/misc/beos/start.c +++ b/misc/beos/start.c @@ -79,12 +79,7 @@ ap_status_t ap_create_context(struct context_t **newcont, struct context_t *cont return APR_ENOPOOL; } - if (cont) { - new = (struct context_t *)ap_palloc(cont, sizeof(struct context_t)); - } - else { - new = (struct context_t *)malloc(sizeof(struct context_t)); - } + new = (struct context_t *)ap_palloc(cont, sizeof(struct context_t)); new->pool = pool; new->prog_data = NULL; @@ -115,7 +110,7 @@ ap_status_t ap_set_userdata(void *data, char *key, if (dptr == NULL) { dptr = ap_palloc(cont, sizeof(datastruct)); dptr->next = dptr->prev = NULL; - dptr->key = strdup(key); + dptr->key = ap_pstrdup(cont, key); if (dptr2) { dptr2->next = dptr; dptr->prev = dptr2; diff --git a/misc/win32/start.c b/misc/win32/start.c index 6b708069d..145ed73e5 100644 --- a/misc/win32/start.c +++ b/misc/win32/start.c @@ -88,12 +88,7 @@ ap_status_t ap_create_context(ap_context_t **newcont, ap_context_t *cont) return APR_ENOPOOL; } - if (cont) { - new = (ap_context_t *)ap_palloc(cont, sizeof(ap_context_t)); - } - else { - new = (ap_context_t *)malloc(sizeof(ap_context_t)); - } + new = (ap_context_t *)ap_palloc(cont, sizeof(ap_context_t)); new->pool = pool; new->prog_data = NULL; @@ -162,7 +157,7 @@ ap_status_t ap_set_userdata(void *data, char *key, if (dptr == NULL) { dptr = ap_palloc(cont, sizeof(datastruct)); dptr->next = dptr->prev = NULL; - dptr->key = strdup(key); + dptr->key = ap_pstrdup(cont, key); if (dptr2) { dptr2->next = dptr; dptr->prev = dptr2; |