[PATCH] dbus: Don't pass NULL message ptr to dbus_message_new_error()

Chinchilla, Angie V angie.v.chinchilla at intel.com
Wed Jul 27 13:08:26 EDT 2011



> -----Original Message-----
> From: Dan Williams [mailto:dcbw at redhat.com]
> Sent: Wednesday, July 27, 2011 9:47 AM
> To: Chinchilla, Angie V
> Cc: hostap at lists.shmoo.com
> Subject: Re: [PATCH] dbus: Don't pass NULL message ptr to
> dbus_message_new_error()
> 
> On Mon, 2011-07-25 at 16:48 -0700, Angie Chinchilla wrote:
> > Found at least 10 code paths that mistakenly assume
> > message is not NULL before invoking
> > dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY, NULL).
> > Created a wrapper method wpas_dbus_error_no_memory() that
> > checks for this case and returns NULL if needed so we don't
> > have if (!message) return NULL else return dbus_message_new_error()
> > blocks scattered all over the code. Also added a couple of log
> > messages to the path that hits this error so the (now gracefully
> > handled) errors don't fail silently.
> 
> I've actually just significantly reworked the new dbus interface code
> to
> fix this problem and clean it up a bunch.  So Jouni, if you don't mind
> waiting for my patch for this issue, that'd be great and we can make a
> determination then.
> 
> Dan
> 

I'm fine with any solution that cleans up the issue. There are also the two (see following patch hunks) memory leaks that should be cleaned up as well. I'll submit a separate patch for those if they don't get cleaned up by your rework.

Thanks,
Angie

> > @@ -647,6 +654,8 @@ static void put_changed_properties(const struct
> wpa_dbus_object_desc *obj_dsc,
> >  			wpa_printf(MSG_ERROR, "dbus: %s: Cannot get new value
> "
> >  				   "of property %s", __func__,
> >  				   dsc->dbus_property);
> > +			if (getter_reply)
> > +				dbus_message_unref(getter_reply);
> >  			continue;
> >  		}
> >
> > @@ -670,6 +679,9 @@ static void put_changed_properties(const struct
> wpa_dbus_object_desc *obj_dsc,
> >  	return;
> >
> >  err:
> > +	if (getter_reply)
> > +		dbus_message_unref(getter_reply);
> > +
> >  	wpa_printf(MSG_ERROR, "dbus: %s: Cannot construct signal",
> __func__);
> >  }
> >
> 



More information about the HostAP mailing list