* Untested patch for trivial memory leak in update-game-score.c
@ 2019-04-30 21:21 Adam Richter
2019-05-01 15:11 ` Tadeus Prastowo
0 siblings, 1 reply; 2+ messages in thread
From: Adam Richter @ 2019-04-30 21:21 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 632 bytes --]
Hi, everyone.
Attached is a patch to update-games-score.c for trivial memory leaks
found by cppcheck. In the hopes of expediting integration, I hereby
release my interest in this patch into the public domain.
As far as I can tell, update-game-score.c is not compiled when I build
emacs, so the purpose of this patch might mostly be to clean up
cppcheck output, but I did compile my modified version of the file
manually, and gcc -Wall had no complaints, although gcc -Wextra
complained about some signed/unsigned comparisons and unlock_file()
ignoring its filename parameter.
Thanks in advance for considering this patch.
Adam
[-- Attachment #2: emacs.update-games-score.diff --]
[-- Type: text/x-diff, Size: 649 bytes --]
--- lib-src/update-game-score.c.orig 2019-01-07 06:26:06.000000000 -0800
+++ lib-src/update-game-score.c 2019-04-30 12:34:23.459986134 -0700
@@ -325,16 +325,21 @@ read_scores (const char *filename, struc
nread = fread (filedata, 1, filesize + 1, f);
if (filesize < nread)
{
+ free (filedata);
errno = 0;
return -1;
}
if (nread < filesize)
filesize = nread;
if (ferror (f) || fclose (f) != 0)
- return -1;
+ {
+ free (filedata);
+ return -1;
+ }
filedata[filesize] = 0;
if (strlen (filedata) != filesize)
{
+ free (filedata);
errno = 0;
return -1;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Untested patch for trivial memory leak in update-game-score.c
2019-04-30 21:21 Untested patch for trivial memory leak in update-game-score.c Adam Richter
@ 2019-05-01 15:11 ` Tadeus Prastowo
0 siblings, 0 replies; 2+ messages in thread
From: Tadeus Prastowo @ 2019-05-01 15:11 UTC (permalink / raw)
To: Adam Richter; +Cc: emacs-devel
On Tue, Apr 30, 2019 at 11:22 PM Adam Richter <adamrichter4@gmail.com> wrote:
> As far as I can tell, update-game-score.c is not compiled when I build
> emacs,
Use the configure flag --with-gameuser, quoting
http://www.gnu.org/software/emacs/news/NEWS.26.1:
** The configure option '--with-gameuser' now defaults to 'no',
as this appears to be the most common configuration in practice.
When it is 'no', the shared game directory and the auxiliary program
update-game-score are no longer needed and are not installed.
But, without that configure flag, you will hit this bug:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=35056
> Adam
--
Best regards,
Tadeus
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-05-01 15:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-30 21:21 Untested patch for trivial memory leak in update-game-score.c Adam Richter
2019-05-01 15:11 ` Tadeus Prastowo
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.