freesdp-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freesdp-devel] Memory allocation-deallocation problems (no problem in


From: Dimitris Beletsiotis
Subject: [freesdp-devel] Memory allocation-deallocation problems (no problem in Linux)
Date: Fri, 28 Feb 2003 12:14:51 +0200

Hi,

I am trying to use FreeSDP-0.4.0 in VxWorks.
I am encountering problems due to memory allocation-deallocation bugs, for
example:

In common.c, fsdp_description_recycle function:

---------------------------------------------------------------------
  for ( i = 0; i < dsc->time_periods_count; i++ ) {
    for ( j = 0; j < dsc->time_periods[i]->repeats_count; j++ ) {
      free(dsc->time_periods[i]->repeats[j]->offsets);
      free(dsc->time_periods[i]->repeats[j]);
    }
    free(dsc->time_periods[i]->repeats);
    free(dsc->time_periods[i]);
  }
  free(dsc->time_periods);
---------------------------------------------------------------------

dsc->time_periods[i]->repeats pointers are freed even if there are no "r="
lines.
In parser.c, fsdp_parse function, memory is being allocated to these
pointers only if "r=" lines exist.

I had also problems during the deallocation of pointers pointing to non-NULL
addresses.
To overcome these problem I changed the following malloc calls (in parser.c)
to calloc:

---------------------------------------------------------------------
/*
    dsc->time_periods[j] = malloc(sizeof(fsdp_time_period_t));
*/
    dsc->time_periods[j] = calloc(1, sizeof(fsdp_time_period_t));

/*
    dsc->time_periods[j] = malloc(sizeof(fsdp_time_period_t));
*/
    dsc->time_periods[j] = calloc(1, sizeof(fsdp_time_period_t));

/*
          malloc(sizeof(fsdp_media_announcement_t));
*/
          calloc(1,sizeof(fsdp_media_announcement_t));
---------------------------------------------------------------------

I have not checked if these problems have been solved in newer versions,
sorry about this.

Regards,

Dimitris Beletsiotis
Embedded Systems Engineer

INTRACOM S.A.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]