mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 03:20:57 +00:00
Issue 9869 - replace malloc and memset with ast_calloc, and other coding guidelines changes
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@67864 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -105,16 +105,16 @@ int ast_speech_results_free(struct ast_speech_result *result)
|
||||
prev_result = current_result;
|
||||
/* Deallocate what we can */
|
||||
if (current_result->text != NULL) {
|
||||
free(current_result->text);
|
||||
ast_free(current_result->text);
|
||||
current_result->text = NULL;
|
||||
}
|
||||
if (current_result->grammar != NULL) {
|
||||
free(current_result->grammar);
|
||||
ast_free(current_result->grammar);
|
||||
current_result->grammar = NULL;
|
||||
}
|
||||
/* Move on and then free ourselves */
|
||||
current_result = current_result->next;
|
||||
free(prev_result);
|
||||
ast_free(prev_result);
|
||||
prev_result = NULL;
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ struct ast_speech *ast_speech_new(char *engine_name, int format)
|
||||
/* Pass ourselves to the engine so they can set us up some more and if they error out then do not create a structure */
|
||||
if (engine->create(new_speech)) {
|
||||
ast_mutex_destroy(&new_speech->lock);
|
||||
free(new_speech);
|
||||
ast_free(new_speech);
|
||||
new_speech = NULL;
|
||||
}
|
||||
|
||||
@@ -211,10 +211,10 @@ int ast_speech_destroy(struct ast_speech *speech)
|
||||
|
||||
/* If a processing sound is set - free the memory used by it */
|
||||
if (speech->processing_sound)
|
||||
free(speech->processing_sound);
|
||||
ast_free(speech->processing_sound);
|
||||
|
||||
/* Aloha we are done */
|
||||
free(speech);
|
||||
ast_free(speech);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
Reference in New Issue
Block a user