GUACAMOLE-1867: Migrate guaclog utility to new memory management functions.
This commit is contained in:
parent
bbf84f4088
commit
944370bdb6
@ -21,6 +21,9 @@
|
||||
#include "keydef.h"
|
||||
#include "log.h"
|
||||
|
||||
#include <guacamole/mem.h>
|
||||
#include <guacamole/string.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
@ -279,16 +282,16 @@ static guaclog_keydef* guaclog_get_unicode_key(int keysym) {
|
||||
*/
|
||||
static guaclog_keydef* guaclog_copy_key(guaclog_keydef* keydef) {
|
||||
|
||||
guaclog_keydef* copy = malloc(sizeof(guaclog_keydef));
|
||||
guaclog_keydef* copy = guac_mem_alloc(sizeof(guaclog_keydef));
|
||||
|
||||
/* Always copy keysym and name */
|
||||
copy->keysym = keydef->keysym;
|
||||
copy->name = strdup(keydef->name);
|
||||
copy->name = guac_strdup(keydef->name);
|
||||
copy->modifier = keydef->modifier;
|
||||
|
||||
/* Copy value only if defined */
|
||||
if (keydef->value != NULL)
|
||||
copy->value = strdup(keydef->value);
|
||||
copy->value = guac_strdup(keydef->value);
|
||||
else
|
||||
copy->value = NULL;
|
||||
|
||||
@ -322,9 +325,9 @@ void guaclog_keydef_free(guaclog_keydef* keydef) {
|
||||
if (keydef == NULL)
|
||||
return;
|
||||
|
||||
free(keydef->name);
|
||||
free(keydef->value);
|
||||
free(keydef);
|
||||
guac_mem_free(keydef->name);
|
||||
guac_mem_free(keydef->value);
|
||||
guac_mem_free(keydef);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -22,6 +22,9 @@
|
||||
#include "log.h"
|
||||
#include "state.h"
|
||||
|
||||
#include <guacamole/mem.h>
|
||||
#include <guacamole/string.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
@ -50,7 +53,7 @@ guaclog_state* guaclog_state_alloc(const char* path) {
|
||||
}
|
||||
|
||||
/* Allocate state */
|
||||
guaclog_state* state = (guaclog_state*) calloc(1, sizeof(guaclog_state));
|
||||
guaclog_state* state = (guaclog_state*) guac_mem_zalloc(sizeof(guaclog_state));
|
||||
if (state == NULL) {
|
||||
goto fail_state;
|
||||
}
|
||||
@ -90,7 +93,7 @@ int guaclog_state_free(guaclog_state* state) {
|
||||
/* Close output file */
|
||||
fclose(state->output);
|
||||
|
||||
free(state);
|
||||
guac_mem_free(state);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user