svn commit: samba r2017 - in branches/SAMBA_4_0/source: intl lib
Andrew Bartlett
abartlet at samba.org
Wed Aug 25 01:01:03 GMT 2004
On Wed, 2004-08-25 at 01:38, metze at samba.org wrote:
> Author: metze
> Date: 2004-08-24 15:38:57 +0000 (Tue, 24 Aug 2004)
> New Revision: 2017
>
> WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source&rev=2017&nolog=1
>
> Log:
> fix compiler warnings
And introduce memory leaks instead :-)
> metze
>
> Modified:
> branches/SAMBA_4_0/source/intl/lang_tdb.c
> branches/SAMBA_4_0/source/lib/dprintf.c
>
>
> Changeset:
> Modified: branches/SAMBA_4_0/source/intl/lang_tdb.c
> ===================================================================
> --- branches/SAMBA_4_0/source/intl/lang_tdb.c 2004-08-24 13:26:31 UTC (rev 2016)
> +++ branches/SAMBA_4_0/source/intl/lang_tdb.c 2004-08-24 15:38:57 UTC (rev 2017)
> @@ -169,13 +169,13 @@
> /* translate a msgid to a message string in the current language
> returns a string that must be freed by calling lang_msg_free()
> */
> -const char *lang_msg(const char *msgid)
> +char *lang_msg(const char *msgid)
> {
> TDB_DATA key, data;
>
> lang_tdb_init(NULL);
>
> - if (!tdb) return msgid;
> + if (!tdb) return strdup(msgid);
While wasteful, this would be ok, except for...
> key.dptr = strdup(msgid);
> key.dsize = strlen(msgid)+1;
> @@ -189,12 +189,12 @@
> if (!data.dptr)
> return strdup(msgid);
>
> - return (const char *)data.dptr;
> + return data.dptr;
> }
>
>
> /* free up a string from lang_msg() */
> -void lang_msg_free(const char *msgstr)
> +void lang_msg_free(char *msgstr)
> {
This line:
> if (!tdb) return;
If we are going to strdup it always, not just in the tdb case, then we
need to always free it here.
> free(msgstr);
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.samba.org/archive/samba-technical/attachments/20040825/d1d6509b/attachment.bin
More information about the samba-technical
mailing list