| 1 | /************************************************** |
|---|---|
| 2 | * ODBCINSTDestructProperties |
| 3 | * |
| 4 | ************************************************** |
| 5 | * This code was created by Peter Harvey @ CodeByDesign. |
| 6 | * Released under LGPL 28.JAN.99 |
| 7 | * |
| 8 | * Contributions from... |
| 9 | * ----------------------------------------------- |
| 10 | * Peter Harvey - pharvey@codebydesign.com |
| 11 | **************************************************/ |
| 12 | #include <config.h> |
| 13 | #include <odbcinstext.h> |
| 14 | |
| 15 | int ODBCINSTDestructProperties( HODBCINSTPROPERTY *hFirstProperty ) |
| 16 | { |
| 17 | HODBCINSTPROPERTY hNextProperty; |
| 18 | HODBCINSTPROPERTY hCurProperty; |
| 19 | |
| 20 | /* SANITY CHECKS */ |
| 21 | if ( (*hFirstProperty) == NULL ) |
| 22 | { |
| 23 | inst_logPushMsg( __FILE__, __FILE__, __LINE__, LOG_CRITICAL, ODBC_ERROR_GENERAL_ERR, "Invalid property list handle"); |
| 24 | return ODBCINST_ERROR; |
| 25 | } |
| 26 | |
| 27 | /* FREE MEMORY */ |
| 28 | for ( hCurProperty = (*hFirstProperty); hCurProperty != NULL; hCurProperty = hNextProperty ) |
| 29 | { |
| 30 | hNextProperty = hCurProperty->pNext; |
| 31 | |
| 32 | /* FREE ANY PROMPT DATA (ie pick list options and such) */ |
| 33 | if ( hCurProperty->aPromptData != NULL ) |
| 34 | free( hCurProperty->aPromptData ); |
| 35 | |
| 36 | /* 1st PROPERTY HAS HANDLE TO DriverSetup DLL; LETS LET THE O/S KNOW WE ARE DONE WITH IT */ |
| 37 | if ( hCurProperty == (*hFirstProperty) && hCurProperty->hDLL != NULL ) |
| 38 | lt_dlclose( hCurProperty->hDLL ); |
| 39 | |
| 40 | /* FREE OTHER STUFF */ |
| 41 | if ( hCurProperty->pszHelp != NULL ) |
| 42 | free( hCurProperty->pszHelp ); |
| 43 | |
| 44 | free( hCurProperty ); |
| 45 | } |
| 46 | (*hFirstProperty) = NULL; |
| 47 | |
| 48 | return ODBCINST_SUCCESS; |
| 49 | } |
| 50 | |
| 51 |