replaced a ton of free or strdup calls for zap_safe_free and zap_strdup

git-svn-id: http://svn.openzap.org/svn/openzap/branches/sangoma_boost@864 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Moises Silva
2009-11-16 14:52:02 +00:00
parent f3d2328564
commit 34307d8e52
16 changed files with 62 additions and 60 deletions

View File

@@ -142,7 +142,7 @@ TELETONE_API(int) teletone_init_session(teletone_generation_session_t *ts, int b
TELETONE_API(int) teletone_destroy_session(teletone_generation_session_t *ts)
{
if (ts->buffer) {
free(ts->buffer);
zap_safe_free(ts->buffer);
ts->buffer = NULL;
ts->samples = 0;
}
@@ -270,19 +270,6 @@ TELETONE_API(int) teletone_mux_tones(teletone_generation_session_t *ts, teletone
return ts->samples;
}
/* don't ask */
static char *my_strdup (const char *s)
{
size_t len = strlen (s) + 1;
void *new = zap_malloc(len);
if (new == NULL) {
return NULL;
}
return (char *) memcpy (new, s, len);
}
TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cmd)
{
char *data = NULL, *cur = NULL, *end = NULL;
@@ -293,7 +280,7 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm
}
do {
if (!(data = my_strdup(cmd))) {
if (!(data = zap_strdup(cmd))) {
return -1;
}
@@ -442,7 +429,7 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm
}
}
bottom:
free(data);
zap_safe_free(data);
data = NULL;
if (ts->LOOPS > 0) {
ts->LOOPS--;