1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00

wmaker: do not duplicate a string that does not need to be (Coverity #72814)

As coverity pointed, the duplicated string was never freed. Considering
what is done with it, is not necessary to allocate a duplicate for it, it
is a waste of time and participates in memory fragmentation.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
This commit is contained in:
Christophe CURIS
2014-11-15 19:40:54 +01:00
committed by Carlos R. Mafra
parent 285a926539
commit 877c26b467

View File

@@ -515,9 +515,6 @@ char *ExpandOptions(WScreen *scr, const char *cmdline)
char *out, *nout;
char *selection = NULL;
char *user_input = NULL;
#ifdef XDND
char *dropped_thing = NULL;
#endif
char tmpbuf[TMPBUFSIZE];
int slen;
@@ -627,14 +624,11 @@ char *ExpandOptions(WScreen *scr, const char *cmdline)
#ifdef XDND
case 'd':
if (scr->xdestring) {
dropped_thing = wstrdup(scr->xdestring);
}
if (!dropped_thing) {
if (!scr->xdestring) {
scr->flags.dnd_data_convertion_status = 1;
goto error;
}
slen = strlen(dropped_thing);
slen = strlen(scr->xdestring);
olen += slen;
nout = realloc(out, olen);
if (!nout) {
@@ -642,7 +636,7 @@ char *ExpandOptions(WScreen *scr, const char *cmdline)
goto error;
}
out = nout;
strcat(out, dropped_thing);
strcat(out, scr->xdestring);
optr += slen;
break;
#endif /* XDND */