From 0171399274c80e2bc87e25607afe2eaa872bb29a Mon Sep 17 00:00:00 2001 From: Angus Salkeld Date: Tue, 8 Nov 2011 10:41:32 +1100 Subject: [PATCH] Remove unnecessary checks before free() Signed-off-by: Angus Salkeld --- lib/ipcs.c | 4 +--- lib/log.c | 6 +----- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/ipcs.c b/lib/ipcs.c index abffa9c..70d4382 100644 --- a/lib/ipcs.c +++ b/lib/ipcs.c @@ -432,9 +432,7 @@ qb_ipcs_connection_unref(struct qb_ipcs_connection *c) c->service->serv_fns.connection_destroyed(c); } c->service->funcs.disconnect(c); - if (c->receive_buf) { - free(c->receive_buf); - } + free(c->receive_buf); free(c); } } diff --git a/lib/log.c b/lib/log.c index bd1c5c7..6c0509f 100644 --- a/lib/log.c +++ b/lib/log.c @@ -930,11 +930,7 @@ qb_log_ctl(int32_t t, enum qb_log_conf c, int32_t arg) void qb_log_format_set(int32_t t, const char *format) { - if (conf[t].format) { - free(conf[t].format); - conf[t].format = NULL; - } - + free(conf[t].format); conf[t].format = strdup(format ? format : "[%p] %b"); assert(conf[t].format != NULL); }