/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
  
1653
1652
      int status;
1654
1653
      if(TEMP_FAILURE_RETRY(waitpid(hook_pid, &status, 0)) == -1){
1655
1654
        perror_plus("waitpid");
1656
 
        free(direntry);
1657
1655
        continue;
1658
1656
      }
1659
1657
      if(WIFEXITED(status)){
1661
1659
          fprintf_plus(stderr, "Warning: network hook \"%s\" exited"
1662
1660
                       " with status %d\n", direntry->d_name,
1663
1661
                       WEXITSTATUS(status));
1664
 
          free(direntry);
1665
1662
          continue;
1666
1663
        }
1667
1664
      } else if(WIFSIGNALED(status)){
1668
1665
        fprintf_plus(stderr, "Warning: network hook \"%s\" died by"
1669
1666
                     " signal %d\n", direntry->d_name,
1670
1667
                     WTERMSIG(status));
1671
 
        free(direntry);
1672
1668
        continue;
1673
1669
      } else {
1674
1670
        fprintf_plus(stderr, "Warning: network hook \"%s\""
1675
1671
                     " crashed\n", direntry->d_name);
1676
 
        free(direntry);
1677
1672
        continue;
1678
1673
      }
1679
1674
    }
1681
1676
      fprintf_plus(stderr, "Network hook \"%s\" ran successfully\n",
1682
1677
                   direntry->d_name);
1683
1678
    }
1684
 
    free(direntry);
1685
1679
  }
1686
1680
  free(direntries);
1687
1681
  if((int)TEMP_FAILURE_RETRY(close(hookdir_fd)) == -1){
2281
2275
        if(ret_errno != 0){
2282
2276
          errno = ret_errno;
2283
2277
          perror_plus("argz_add");
2284
 
          free(direntries[i]);
2285
2278
          continue;
2286
2279
        }
2287
2280
        if(debug){
2288
2281
          fprintf_plus(stderr, "Will use interface \"%s\"\n",
2289
2282
                       direntries[i]->d_name);
2290
2283
        }
2291
 
        free(direntries[i]);
2292
2284
      }
2293
2285
      free(direntries);
2294
2286
    } else {
2646
2638
                         " \"%s\", 0): %s\n", tempdir,
2647
2639
                         direntries[i]->d_name, strerror(errno));
2648
2640
          }
2649
 
          free(direntries[i]);
2650
2641
        }
2651
2642
        
2652
2643
        /* need to clean even if 0 because man page doesn't specify */