From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthew Daley Subject: Re: [PATCH 23/28] mini-os: fix various memory leaks in {fb, kbd}front Date: Thu, 19 Sep 2013 01:01:20 +1200 Message-ID: References: <1379475484-25993-1-git-send-email-mattjd@gmail.com> <1379475484-25993-24-git-send-email-mattjd@gmail.com> <52399F13.10508@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <52399F13.10508@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: Samuel Thibault , Stefano Stabellini , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On Thu, Sep 19, 2013 at 12:39 AM, Andrew Cooper wrote: > On 18/09/2013 04:37, Matthew Daley wrote: >> @@ -532,7 +538,8 @@ done: >> err = xenbus_wait_for_state_change(path, &state, &dev->events); >> if (state != XenbusStateConnected) { >> printk("backend not available, state=%d\n", state); >> - xenbus_unwatch_path_token(XBT_NIL, path, path); >> + if (err) free(err); > > free() is able to deal with being passed a NULL pointer. Therefore, the > "if (err)" is not needed. (And indeed, you dont use it in the next hunk) Right. I was just following the existing style, where it does have the redundant if()s - I count at least 22 cases in the existing code. I guess I can respin these mini-os patches, or I can do just one to remove both the newly added and the old cases across all of mini-os at once after these have gone in. - Matthew