IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 9359 for trunk


Ignore:
Timestamp:
Oct 6, 2006, 10:28:33 AM (20 years ago)
Author:
eugene
Message:

squashing queue leaks

Location:
trunk/Ohana/src/opihi
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/cmd.data/queuepop.c

    r8192 r9359  
    1818
    1919  Key = NULL;
     20  Value = NULL;
    2021  if ((N = get_argument (argc, argv, "-key"))) {
    2122    remove_argument (N, &argc, argv);
     
    4950      return (FALSE);
    5051    } else {
    51       gprint (GP_ERR, "%s\n", line);
     52      gprint (GP_LOG, "%s\n", line);
     53      free (line);
    5254      return (TRUE);
    5355    }
     
    5860  } else {
    5961    set_str_variable (var, line);
     62    free (line);
    6063  }
    6164
    62   free (line);
     65  free (var);
    6366  if (Key != NULL) free (Key);
     67  if (Value != NULL) free (Value);
    6468
    6569  return (TRUE);
  • trunk/Ohana/src/opihi/lib.data/queues.c

    r9280 r9359  
    141141}
    142142
     143// return a newly allocated string containing the requested key value
    143144char *ChooseSingleKey (char *line, int Key) {
    144145
     
    146147  char *key, *p;
    147148
     149  if (Key == -1) {
     150    key = strcreate (line);
     151    return (key);
     152  }
     153
    148154  key = line;
    149   if (Key == -1) return line;
    150 
    151155  for (i = 0; (i < Key) && (key != NULL); i++) {
    152156    p = nextword (key);
     
    192196    first = FALSE;
    193197  }
    194 
    195198  return (output);
    196199}
     
    337340      test = ChooseKey (queue[0].lines[i], Key);
    338341      if (test == NULL) continue;
    339       if (strcmp (value, test)) continue;
     342      if (strcmp (value, test)) {
     343        free (test);
     344        continue;
     345      }
     346      free (test);
    340347      choice = i;
    341348  }
Note: See TracChangeset for help on using the changeset viewer.