Просмотр исходного кода

dpkg: Remove duplicate oldargs variable

Initialize newargs to NULL now that oldargs is not there for the initial
value.

This was spotted by a run with the clang static analyzer.
Guillem Jover лет назад: 16
Родитель
Сommit
5862fd919d
1 измененных файлов с 2 добавлено и 3 удалено
  1. 2 3
      src/main.c

+ 2 - 3
src/main.c

@@ -596,7 +596,7 @@ void commandfd(const char *const *argv) {
   jmp_buf ejbuf;
   struct varbuf linevb = VARBUF_INIT;
   const char * pipein;
-  const char **newargs;
+  const char **newargs = NULL;
   char *ptr, *endptr;
   FILE *in;
   unsigned long infd;
@@ -620,7 +620,6 @@ void commandfd(const char *const *argv) {
   }
 
   for (;;) {
-    const char **oldargs= NULL;
     int argc= 1, mode= 0;
     lno= 0;
     push_error_handler(&ejbuf, print_error_fatal, NULL);
@@ -641,7 +640,7 @@ void commandfd(const char *const *argv) {
     if (c == EOF) ohshit(_("unexpected eof before end of line %d"),lno);
     if (!argc) continue;
     varbufaddc(&linevb,0);
-    oldargs = newargs = m_realloc(oldargs, sizeof(const char *) * (argc + 1));
+    newargs = m_realloc(newargs, sizeof(const char *) * (argc + 1));
     argc= 1;
     ptr= linevb.buf;
     endptr= ptr + linevb.used;