+2008-12-05 Eli Zaretskii <eliz@gnu.org>
+
+ * process.c (procfs_system_process_attributes): Don't use cmd,
+ cmdsize, and q without initializing them first.
+
2008-12-04 Jason Rumney <jasonr@gnu.org>
* w32font.c (w32font_draw): Initialize orig_clip before getting
char procbuf[1025], *p, *q;
int fd;
ssize_t nread;
- const char *cmd;
+ const char *cmd = NULL;
char *cmdline = NULL;
- size_t cmdsize, cmdline_size;
+ size_t cmdsize = 0, cmdline_size;
unsigned char c;
int proc_id, ppid, uid, gid, pgrp, sess, tty, tpgid, thcount;
unsigned long long utime, stime, cutime, cstime, start;
procbuf[nread] = '\0';
p = procbuf;
- cmd = NULL;
p = strchr (p, '(');
if (p != NULL)
{
cmdsize = q - cmd;
}
}
+ else
+ q = NULL;
if (cmd == NULL)
{
cmd = "???";
}
else
{
+ if (!cmd)
+ cmd = "???";
+ if (!cmdsize)
+ cmdsize = strlen (cmd);
cmdline_size = cmdsize + 2;
cmdline = xmalloc (cmdline_size + 1);
strcpy (cmdline, "[");