/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to plugins.d/mandos-client.c

  • Committer: Teddy Hogeborn
  • Date: 2014-07-15 19:35:03 UTC
  • Revision ID: teddy@recompile.se-20140715193503-e18hls7m4rv4l6iq
mandos-client: Fix mem free bug.

* plugins.d/mandos-client.c (add_server): Hide warning.
  (main): Free server->ip too, not just the server struct.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1076
1076
     timed out */
1077
1077
  
1078
1078
  if(quit_now){
1079
 
    avahi_s_service_resolver_free(r);
1080
1079
    return;
1081
1080
  }
1082
1081
  
1650
1649
        _exit(EXIT_FAILURE);
1651
1650
      }
1652
1651
    } else {
1653
 
      if(hook_pid == -1){
1654
 
        perror_plus("fork");
1655
 
        free(direntry);
1656
 
        continue;
1657
 
      }
1658
1652
      int status;
1659
1653
      if(TEMP_FAILURE_RETRY(waitpid(hook_pid, &status, 0)) == -1){
1660
1654
        perror_plus("waitpid");
1661
 
        free(direntry);
1662
1655
        continue;
1663
1656
      }
1664
1657
      if(WIFEXITED(status)){
1666
1659
          fprintf_plus(stderr, "Warning: network hook \"%s\" exited"
1667
1660
                       " with status %d\n", direntry->d_name,
1668
1661
                       WEXITSTATUS(status));
1669
 
          free(direntry);
1670
1662
          continue;
1671
1663
        }
1672
1664
      } else if(WIFSIGNALED(status)){
1673
1665
        fprintf_plus(stderr, "Warning: network hook \"%s\" died by"
1674
1666
                     " signal %d\n", direntry->d_name,
1675
1667
                     WTERMSIG(status));
1676
 
        free(direntry);
1677
1668
        continue;
1678
1669
      } else {
1679
1670
        fprintf_plus(stderr, "Warning: network hook \"%s\""
1680
1671
                     " crashed\n", direntry->d_name);
1681
 
        free(direntry);
1682
1672
        continue;
1683
1673
      }
1684
1674
    }
1686
1676
      fprintf_plus(stderr, "Network hook \"%s\" ran successfully\n",
1687
1677
                   direntry->d_name);
1688
1678
    }
1689
 
    free(direntry);
1690
1679
  }
1691
1680
  free(direntries);
1692
1681
  if((int)TEMP_FAILURE_RETRY(close(hookdir_fd)) == -1){
2286
2275
        if(ret_errno != 0){
2287
2276
          errno = ret_errno;
2288
2277
          perror_plus("argz_add");
2289
 
          free(direntries[i]);
2290
2278
          continue;
2291
2279
        }
2292
2280
        if(debug){
2293
2281
          fprintf_plus(stderr, "Will use interface \"%s\"\n",
2294
2282
                       direntries[i]->d_name);
2295
2283
        }
2296
 
        free(direntries[i]);
2297
2284
      }
2298
2285
      free(direntries);
2299
2286
    } else {
2651
2638
                         " \"%s\", 0): %s\n", tempdir,
2652
2639
                         direntries[i]->d_name, strerror(errno));
2653
2640
          }
2654
 
          free(direntries[i]);
2655
2641
        }
2656
2642
        
2657
2643
        /* need to clean even if 0 because man page doesn't specify */