1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
Description: Fix some problems detected by cppcheck.
Forwarded: no
Author: Peter Pentchev <roam@ringlet.net>
Last-Update: 2014-02-11
--- a/mixgtk/mixgtk_mixal.c
+++ b/mixgtk/mixgtk_mixal.c
@@ -255,7 +255,7 @@
gchar *new_tip;
gchar **tokens;
gchar *text = g_strdup (line);
- text = g_strdelimit (text, DELIMITERS, ' ');
+ g_strdelimit (text, DELIMITERS, ' ');
tokens = g_strsplit (g_strstrip (text), " ", -1);
while (tokens[k])
{
--- a/mixutils/mixvm_loop.c
+++ b/mixutils/mixvm_loop.c
@@ -53,7 +53,12 @@
enum {LINE_LEN = 256};
char *line = g_new (char, LINE_LEN);
printf ("%s", prompt);
- return fgets (line, LINE_LEN, stdin);
+ if (fgets (line, LINE_LEN, stdin) == NULL)
+ {
+ g_free(line);
+ return (NULL);
+ }
+ return (line);
}
#endif /* HAVE_LIBREADLINE */
|