giochannel: avoid setting uninitialised length
authorRyan Lortie <desrt@desrt.ca>
Fri, 6 Jun 2014 16:16:55 +0000 (12:16 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 28 Jun 2014 17:51:23 +0000 (13:51 -0400)
commit000737612852d76fd1b85b42363901ec6ab12bd9
tree29e3d16de3f3a1d46efe89b815255d5bdc52cda0
parent88b284c07051ccf5a7561d04236d83c8bb61993a
giochannel: avoid setting uninitialised length

Our internal call to g_io_channel_read_line_backend() may return
G_IO_STATUS_ERROR, in which case two things will be true:

 - the GError will have been set (if appropriate)

 - the &got_length return value may not have been set

Since it's our convention to leave 'out' parameters untouched in
exception cases, this is perfectly fine.  Unfortunately,
g_io_channel_read_line(), in wrapping this internal function, always
promotes the length parameter, even in the case of error.

Stop doing that in order to avoid overwriting the callers's variable
with junk in the error case.

https://bugzilla.gnome.org/show_bug.cgi?id=731339
glib/giochannel.c