Fix memory leaks on deinit.

This commit is contained in:
Jeffrey Townsend
2017-09-08 15:20:40 +00:00
parent 88ab3ed487
commit 9038737228
4 changed files with 26 additions and 8 deletions

View File

@@ -59,6 +59,7 @@ typedef enum onlp_status_e {
*/
int onlp_init(void);
int onlp_denit(void);
/**
* @brief Dump the current platform data.

View File

@@ -1,21 +1,21 @@
/************************************************************
* <bsn.cl fy=2014 v=onl>
*
* Copyright 2014, 2015 Big Switch Networks, Inc.
*
*
* Copyright 2014, 2015 Big Switch Networks, Inc.
*
* Licensed under the Eclipse Public License, Version 1.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
*
* http://www.eclipse.org/legal/epl-v10.html
*
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*
*
* </bsn.cl>
************************************************************
*
@@ -62,3 +62,15 @@ onlp_init(void)
onlp_thermal_init();
return 0;
}
int
onlp_denit(void)
{
#if ONLP_CONFIG_INCLUDE_API_LOCK == 1
onlp_api_lock_denit();
#endif
onlp_json_denit();
return 0;
}

View File

@@ -45,6 +45,12 @@ onlp_api_lock_init(void)
api_sem__ = os_sem_create_flags(1, OS_SEM_CREATE_F_TRUE_RELATIVE_TIMEOUTS);
}
void
onlp_api_lock_denit(void)
{
os_sem_destroy(api_sem__);
}
void
onlp_api_lock(const char* api)
{
@@ -119,5 +125,3 @@ onlp_api_lock_test(void)
}
#endif /* ONLP_CONFIG_INCLUDE_API_LOCK */

View File

@@ -33,6 +33,7 @@
* @brief Initialize the ONLP API lock infrastructure.
*/
void onlp_api_lock_init();
void onlp_api_lock_denit();
/**
* @brief Take the ONLP API lock.