From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:60222) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvVHA-0008A0-J8 for qemu-devel@nongnu.org; Wed, 16 Jan 2013 10:51:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TvVH6-0005nZ-9V for qemu-devel@nongnu.org; Wed, 16 Jan 2013 10:51:40 -0500 Message-ID: <50F6CC84.8000908@redhat.com> Date: Wed, 16 Jan 2013 08:51:32 -0700 From: Eric Blake MIME-Version: 1.0 References: <1358346998-26328-1-git-send-email-armbru@redhat.com> <1358346998-26328-5-git-send-email-armbru@redhat.com> In-Reply-To: <1358346998-26328-5-git-send-email-armbru@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2SXCTCWIIQLNHOIOCUUPB" Subject: Re: [Qemu-devel] [PATCH 04/11] readline: Fix unchecked strdup() by converting to g_strdup() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2SXCTCWIIQLNHOIOCUUPB Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 01/16/2013 07:36 AM, Markus Armbruster wrote: > Signed-off-by: Markus Armbruster > --- > readline.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/readline.c b/readline.c > index a0c9638..d6e04d4 100644 > --- a/readline.c > +++ b/readline.c > @@ -247,14 +247,14 @@ static void readline_hist_add(ReadLineState *rs, = const char *cmdline) > } > if (idx =3D=3D READLINE_MAX_CMDS) { > /* Need to get one free slot */ > - free(rs->history[0]); > + g_free(rs->history[0]); > memmove(rs->history, &rs->history[1], > (READLINE_MAX_CMDS - 1) * sizeof(char *)); > rs->history[READLINE_MAX_CMDS - 1] =3D NULL; > idx =3D READLINE_MAX_CMDS - 1; > } > if (new_entry =3D=3D NULL) > - new_entry =3D strdup(cmdline); > + new_entry =3D g_strdup(cmdline); As long as you are converting tabs to spaces, you should also be adding {= }. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2SXCTCWIIQLNHOIOCUUPB Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJQ9syEAAoJEKeha0olJ0Nqft4H/R6pPnt1lqZPOxHnnhUW+dTW 3Gy3vZkW4tct2Qq7Akx4YJL+jZWzmEN1JfoHv4ulOrfCkLl58Ie7nGnvhSJXWDfA h6zEid9zvgwdclXDY3p/p48/bq0MFkSb36vZ/pZDmsN/oGr4/3bdbkPedUXyLnxI xJ0vAcjgAoWnTuZrzrkh5lmwYsNEXCq3sy+cFCiYLga+Uq8i4i4XjMvGW5+gAbAz 5OGxdUs8k23TpkHtUxpBed+1Br5P76jhEdm8HulPpmhpm9+NCdkrT6UTVhavzWui FBRiYJ7DiZZhHckt2+hEecuPL8yAzMIFHqUBQ2mwgcYSQHzB2WqFnsWDpUu3lDY= =KC0b -----END PGP SIGNATURE----- ------enig2SXCTCWIIQLNHOIOCUUPB--