Changeset 52 for trunk/src


Ignore:
Timestamp:
08/08/05 20:43:07 (19 years ago)
Author:
tim
Message:

fixed a double-free bug which FreeBSD (but not Linux) catches and bails on.

other minor tweaks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/reglookup.c

    r48 r52  
    640640void printKeyTree(REGF_FILE* f, void_stack* nk_stack, char* prefix)
    641641{
    642   REGF_NK_REC* cur;
    643   REGF_NK_REC* sub;
     642  REGF_NK_REC* cur = NULL;
     643  REGF_NK_REC* sub = NULL;
    644644  char* path = NULL;
    645645  char* val_path = NULL;
     
    703703                 void_stack* path_stack)
    704704{
    705   REGF_NK_REC* sub;
    706   REGF_NK_REC* cur;
     705  REGF_NK_REC* sub = NULL;
     706  REGF_NK_REC* cur = NULL;
    707707  void_stack* sub_nk_stack;
    708708  char* prefix;
     709  uint32 prefix_len;
    709710  char* cur_str = NULL;
    710711  bool found_cur = true;
     
    765766      sub_nk_stack = void_stack_new(1024);
    766767      void_stack_push(sub_nk_stack, sub);
    767       void_stack_push(nk_stack, sub);
    768768      prefix = stack2Path(nk_stack);
     769      prefix_len = strlen(prefix);
     770      prefix = realloc(prefix, prefix_len+strlen(sub->keyname)+2);
     771      if(prefix == NULL)
     772        return -1;
     773      strcat(prefix, "/");
     774      strcat(prefix, sub->keyname);
    769775      printKeyTree(f, sub_nk_stack, prefix);
    770776      return 0;
Note: See TracChangeset for help on using the changeset viewer.