Fix V773 warning from PVS-Studio Static Analyzer
The function was exited without releasing a pointer. A memory leak is possible.
This commit is contained in:
parent
f9bf041b50
commit
5cdbcc3dd2
|
@ -1654,8 +1654,10 @@ domailuser (char *username)
|
|||
DGL_MAILMSGLEN);
|
||||
mvaddstr (7, 1, "=> ");
|
||||
|
||||
if (mygetnstr (message, DGL_MAILMSGLEN, 1) != OK)
|
||||
if (mygetnstr (message, DGL_MAILMSGLEN, 1) != OK) {
|
||||
if (spool_fn) free(spool_fn);
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < strlen (message); i++)
|
||||
{
|
||||
|
@ -2558,6 +2560,7 @@ purge_stale_locks (int game)
|
|||
{
|
||||
nocbreak(); /* leave half-delay */
|
||||
cbreak();
|
||||
if (fn) free(fn);
|
||||
return 0;
|
||||
}
|
||||
mvprintw (3, 50 + strlen(myconfig[game]->game_name), "%d%s", seconds, (seconds > 9) ? "" : " ");
|
||||
|
|
|
@ -223,7 +223,11 @@ dgl_exec_cmdqueue(struct dg_cmdpart *queue, int game, struct dg_user *me)
|
|||
p1 = (char *)malloc(1024);
|
||||
p2 = (char *)malloc(1024);
|
||||
|
||||
if (!p1 || !p2) return 1;
|
||||
if (!p1 || !p2) {
|
||||
if (p1) free(p1);
|
||||
if (p2) free(p2);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return_from_submenu = 0;
|
||||
|
||||
|
@ -635,6 +639,8 @@ populate_games (int xgame, int *l, struct dg_user *me)
|
|||
debug_write("cannot open inprogress-dir");
|
||||
graceful_exit (140);
|
||||
}
|
||||
free(dir);
|
||||
dir = NULL;
|
||||
|
||||
while ((pdirent = readdir (pdir)))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue