Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-12036

Memory leak in zabbix_get

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Won't fix
    • Icon: Trivial Trivial
    • None
    • 2.2.17
    • Agent (G)
    • Sprint 14
    • 0.5

      src/zabbix_get/zabbix_get.c:184

      	/* parse the command-line */
      	while ((char)EOF != (ch = (char)zbx_getopt_long(argc, argv, shortopts, longopts, NULL)))
      	{
      		switch (ch)
      		{
      			case 'k':
      				key = strdup(zbx_optarg);
      				break;
      			case 'p':
      				port = (unsigned short)atoi(zbx_optarg);
      				break;
      			case 's':
      				host = strdup(zbx_optarg);
      				break;
      			case 'I':
      				source_ip = strdup(zbx_optarg);
      				break;
      			case 'h':
      				help();
      				exit(-1);
      				break;
      			case 'V':
      				version();
      				exit(-1);
      				break;
      			default:
      				usage();
      				exit(-1);
      				break;
      		}
      	}
      

      the variable source_ip allocated dynamically by strdup() is never freed. 3.0, 3.2 and trunk are not affected as the source_ip variables is properly freed in the out goto label.

      Spotted by the clang static analyzer

            Unassigned Unassigned
            abs Andrea Biscuola (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: