VirtualBox

Changeset 102563 in vbox


Ignore:
Timestamp:
Dec 11, 2023 9:14:20 AM (15 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
160709
Message:

IPRT/http-curl: Added trying to use the dedicated px_proxy_factory_free_proxies() API if available, instead of free'ing stuff ourselves. Only for libproxy >= 0.4.16.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/generic/http-curl.cpp

    r98103 r102563  
    301301typedef void             (* PFNLIBPROXYFACTORYDTOR)(PLIBPROXYFACTORY);
    302302typedef char          ** (* PFNLIBPROXYFACTORYGETPROXIES)(PLIBPROXYFACTORY, const char *);
     303typedef void             (* PFNLIBPROXYFACTORYFREEPROXIES)(char **);
    303304#endif
    304305
     
    364365static PFNLIBPROXYFACTORYDTOR                   g_pfnLibProxyFactoryDtor = NULL;
    365366static PFNLIBPROXYFACTORYGETPROXIES             g_pfnLibProxyFactoryGetProxies = NULL;
     367/** Note: Only valid for libproxy >= 0.4.16. */
     368static PFNLIBPROXYFACTORYFREEPROXIES            g_pfnLibProxyFactoryFreeProxies = NULL;
    366369/** @} */
    367370#endif
     
    10651068        if (RT_SUCCESS(rc))
    10661069        {
     1070            /* libproxy < 0.4.16 does not have this function, so this is not fatal if not found. */
     1071            RTLdrGetSymbol(hMod, "px_proxy_factory_free_proxies", (void **)&g_pfnLibProxyFactoryFreeProxies);
     1072        }
     1073        if (RT_SUCCESS(rc))
     1074        {
    10671075            RTMEM_WILL_LEAK(hMod);
    10681076            g_hLdrLibProxy = hMod;
     
    10981106        {
    10991107            char **papszProxies = g_pfnLibProxyFactoryGetProxies(pFactory, pszUrl);
    1100             g_pfnLibProxyFactoryDtor(pFactory);
    11011108            if (papszProxies)
    11021109            {
     
    11201127                }
    11211128
    1122                 /* free the result. */
    1123                 for (unsigned i = 0; papszProxies[i]; i++)
    1124                     free(papszProxies[i]);
    1125                 free(papszProxies);
     1129                /* Free the result. */
     1130                if (g_pfnLibProxyFactoryFreeProxies) /* libproxy >= 0.4.16. */
     1131                {
     1132                    g_pfnLibProxyFactoryFreeProxies(papszProxies);
     1133                }
     1134                else
     1135                {
     1136                    for (unsigned i = 0; papszProxies[i]; i++)
     1137                        free(papszProxies[i]);
     1138                    free(papszProxies);
     1139                }
     1140                papszProxies = NULL;
    11261141            }
     1142
     1143            g_pfnLibProxyFactoryDtor(pFactory);
    11271144        }
    11281145    }
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette