Minor fixes

This commit is contained in:
pancake 2019-04-19 13:30:20 +02:00
parent 376ee077ff
commit 170bec4793
2 changed files with 13 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* radare2 - LGPL - Copyright 2018 - pancake */
/* radare2 - LGPL - Copyright 2018-2019 - pancake */
#include <r_core.h>
@ -12,18 +12,21 @@ TODO:
R_API RCoreUndo *r_core_undo_new(ut64 offset, const char *action, const char *revert) {
RCoreUndo *cu = R_NEW (RCoreUndo);
cu->action = strdup (action);
cu->revert = strdup (revert);
cu->tstamp = r_sys_now ();
cu->offset = offset;
if (cu) {
cu->action = strdup (action);
cu->revert = strdup (revert);
cu->tstamp = r_sys_now ();
cu->offset = offset;
}
return cu;
}
R_API void *r_core_undo_free(RCoreUndo *cu) {
free (cu->action);
free (cu->revert);
R_API void r_core_undo_free(RCoreUndo *cu) {
if (cu) {
free (cu->action);
free (cu->revert);
}
free (cu);
return NULL;
}
R_API void r_core_undo_push(RCore *core, RCoreUndo *cu) {

View File

@ -754,7 +754,7 @@ R_API int r_core_cmpwatch_revert (RCore *core, ut64 addr);
/* undo */
R_API RCoreUndo *r_core_undo_new(ut64 offset, const char *action, const char *revert);
R_API void r_core_undo_print(RCore *core, int mode, RCoreUndoCondition *cond);
R_API void *r_core_undo_free(RCoreUndo *cu);
R_API void r_core_undo_free(RCoreUndo *cu);
R_API void r_core_undo_push(RCore *core, RCoreUndo *cu);
R_API void r_core_undo_pop(RCore *core);