On Wed, Mar 10, 2010 at 06:40:16PM +0300, Dmitry V. Levin wrote:
> On Wed, Mar 10, 2010 at 02:55:40PM +0200, Sergey Poznyakoff wrote:
> > I am pleased to announce the release of GNU tar version 1.23.
> 
> There is a new compilation warning in this release:
> names.c: In function 'collect_and_sort_names':
> names.c:874: warning: 'prev_name' may be used uninitialized in this function
> 
> The warning is not a false alarm this time.  I've looked at the code
> and confirm that this variable is used uninitialized.

And yet one more use of uninitialized variable:

--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1374,7 +1374,6 @@ static bool
 check_label_pattern (const char *label)
 {
   char *string;
-  bool result;
 
   if (fnmatch (volume_label_option, label, 0) == 0)
     return true;
@@ -1385,10 +1384,11 @@ check_label_pattern (const char *label)
   string = drop_volume_label_suffix (label);
   if (string)
     {
-      result = fnmatch (string, volume_label_option, 0) == 0;
+      bool result = fnmatch (string, volume_label_option, 0) == 0;
       free (string);
+      return result;
     }
-  return result;
+  return false;
 }
 
 /* Check if the next block contains a volume label and if this matches


-- 
ldv

Attachment: pgpQkXSHq1feG.pgp
Description: PGP signature

Reply via email to