Changeset eee1432 in mod_gnutls


Ignore:
Timestamp:
Jun 15, 2016, 6:12:50 PM (18 months ago)
Author:
Thomas Klute <thomas2.klute@…>
Branches:
master, debian, upstream
Children:
44e8944
Parents:
45b7b83
Message:

Bind temporary pool in mgs_load_files() to ptemp scope

Pool 'spool' is destroyed at the end of the function, so the temporary
scope is definitely appropriate. This ensures cleanup in case a bug
prevents explicit pool destruction.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • include/mod_gnutls.h.in

    rcc74801 reee1432  
    362362
    363363/* Loads all files set in the configuration */
    364 int mgs_load_files(apr_pool_t * p, server_rec * s);
     364int mgs_load_files(apr_pool_t *pconf, apr_pool_t *ptemp, server_rec *s)
     365    __attribute__((nonnull));
    365366
    366367const char *mgs_set_srp_tpasswd_conf_file(cmd_parms * parms, void *dummy,
  • src/gnutls_config.c

    r45b7b83 reee1432  
    176176}
    177177
    178 int mgs_load_files(apr_pool_t * p, server_rec * s)
     178int mgs_load_files(apr_pool_t *pconf, apr_pool_t *ptemp, server_rec *s)
    179179{
    180180    apr_pool_t *spool;
     
    186186                                                 &gnutls_module);
    187187
    188     apr_pool_create(&spool, p);
    189 
    190     sc->cert_pgp = apr_pcalloc(p, sizeof(sc->cert_pgp[0]));
    191     sc->cert_crt_pgp = apr_pcalloc(p, sizeof(sc->cert_crt_pgp[0]));
     188    apr_pool_create(&spool, ptemp);
     189
     190    sc->cert_pgp = apr_pcalloc(pconf, sizeof(sc->cert_pgp[0]));
     191    sc->cert_crt_pgp = apr_pcalloc(pconf, sizeof(sc->cert_crt_pgp[0]));
    192192    sc->certs_x509_chain =
    193         apr_pcalloc(p, MAX_CHAIN_SIZE * sizeof(sc->certs_x509_chain[0]));
     193        apr_pcalloc(pconf, MAX_CHAIN_SIZE * sizeof(sc->certs_x509_chain[0]));
    194194    sc->certs_x509_crt_chain =
    195         apr_pcalloc(p, MAX_CHAIN_SIZE * sizeof(sc->certs_x509_crt_chain[0]));
     195        apr_pcalloc(pconf, MAX_CHAIN_SIZE * sizeof(sc->certs_x509_crt_chain[0]));
    196196
    197197    /* Cleanup function for the GnuTLS structures allocated below */
    198     apr_pool_cleanup_register(p, sc, mgs_pool_free_credentials,
     198    apr_pool_cleanup_register(pconf, sc, mgs_pool_free_credentials,
    199199                              apr_pool_cleanup_null);
    200200
  • src/gnutls_hooks.c

    rcc74801 reee1432  
    313313int mgs_hook_post_config(apr_pool_t *pconf,
    314314                         apr_pool_t *plog __attribute__((unused)),
    315                          apr_pool_t *ptemp __attribute__((unused)),
     315                         apr_pool_t *ptemp,
    316316                         server_rec *base_server)
    317317{
     
    393393        sc->cache = sc_base->cache;
    394394
    395         rv = mgs_load_files(pconf, s);
     395        rv = mgs_load_files(pconf, ptemp, s);
    396396        if (rv != 0) {
    397397            ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, s,
Note: See TracChangeset for help on using the changeset viewer.