diff --git a/libr/anal/sign.c b/libr/anal/sign.c index 1c7b70b53a..779e91c41b 100644 --- a/libr/anal/sign.c +++ b/libr/anal/sign.c @@ -2375,10 +2375,12 @@ static RListIter *collision_skip_unused(RListIter *iter, RSignType *used) { RListIter *next; while ((next = r_list_iter_get_next (iter))) { n = r_list_iter_get_data (next); - RSignType t = n[0]; - if (!n || skip != t) { - if (type_in_array (used, t)) { - return iter; + if (n) { + RSignType t = n[0]; + if (skip != t) { + if (type_in_array (used, t)) { + return iter; + } } } iter = next; diff --git a/libr/core/cmd_hash.c b/libr/core/cmd_hash.c index b30a3bca2f..b104f24ac4 100644 --- a/libr/core/cmd_hash.c +++ b/libr/core/cmd_hash.c @@ -96,7 +96,9 @@ static void handle_luhn(const ut8 *block, int len) { } static void handle_ssdeep(const ut8 *block, int len) { - r_cons_printf ("%s\n", r_hash_ssdeep (block, len)); + char *res = r_hash_ssdeep (block, len); + r_cons_printf ("%s\n", res); + free (res); } static void handle_crc8_smbus(const ut8 *block, int len) { diff --git a/libr/core/disasm.c b/libr/core/disasm.c index 6da711eafa..a2250a04a6 100644 --- a/libr/core/disasm.c +++ b/libr/core/disasm.c @@ -2521,7 +2521,7 @@ static int ds_disassemble(RDisasmState *ds, ut8 *buf, int len) { char *op_hex = r_asm_op_get_hex (&ds->asmop); r_asm_op_set_asm (&ds->asmop, sdb_fmt (".hex %s%s", op_hex, tail)); bool be = ds->core->print->big_endian; - int immbase = (ds && ds->hint && ds->hint->immbase)? ds->hint->immbase: 0; + int immbase = (ds->hint && ds->hint->immbase)? ds->hint->immbase: 0; switch (meta_size) { case 2: ds->analop.val = r_read_ble16 (buf, be); diff --git a/libr/io/p/io_socket.c b/libr/io/p/io_socket.c index cf41454adc..1ae06e71fb 100644 --- a/libr/io/p/io_socket.c +++ b/libr/io/p/io_socket.c @@ -15,9 +15,11 @@ typedef struct { static void free_socketdata(RIOSocketData *sd) { - r_socket_free (sd->sc); - r_socket_free (sd->sl); - free (sd); + if (sd) { + r_socket_free (sd->sc); + r_socket_free (sd->sl); + free (sd); + } } static int __write(RIO *io, RIODesc *desc, const ut8 *buf, int count) { @@ -119,12 +121,14 @@ static RIODesc *__open(RIO *io, const char *pathname, int rw, int mode) { } else { eprintf ("Missing port.\n"); free_socketdata (data); + free (host); return NULL; } /* listen and wait for connection */ data->sc = r_socket_new (false); if (!r_socket_connect (data->sc, host, port, R_SOCKET_PROTO_TCP, 0)) { eprintf ("Cannot connect\n"); + free (host); free_socketdata (data); return NULL; }