aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Jones <dave@waveform.org.uk>2020-11-09 20:18:54 +0000
committerDave Jones <dave@waveform.org.uk>2020-11-09 20:18:54 +0000
commit52be50a71d7915c0e5690e901f5bae58e79fc4fb (patch)
treec1f80e9efea99560c61c7dd9ad5af667a923c1dd
parent029da3e6501cfd11519eff87be3ac0f55f0bfb15 (diff)
downloadkbd-52be50a71d7915c0e5690e901f5bae58e79fc4fb.tar.gz
Fix use-after-free of pipe_cmd
-rw-r--r--src/libkbdfile/kbdfile.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libkbdfile/kbdfile.c b/src/libkbdfile/kbdfile.c
index 8e031f69..5a8f3a81 100644
--- a/src/libkbdfile/kbdfile.c
+++ b/src/libkbdfile/kbdfile.c
@@ -115,15 +115,15 @@ pipe_open(const struct decompressor *dc, struct kbdfile *fp)
fp->fd = popen(pipe_cmd, "r");
fp->flags |= KBDFILE_PIPE;
- free(pipe_cmd);
-
if (!(fp->fd)) {
char buf[200];
strerror_r(errno, buf, sizeof(buf));
ERR(fp->ctx, "popen: %s: %s", pipe_cmd, buf);
+ free(pipe_cmd);
return -1;
}
+ free(pipe_cmd);
return 0;
}