mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 20:38:08 +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:
committed by
Carlos R. Mafra
parent
285a926539
commit
877c26b467
12
src/misc.c
12
src/misc.c
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user