mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-13 04:57:05 +00:00
FS-9785: upgrade libsrtp to 2.1
This commit is contained in:
1 parent
19e8621682
commit
3bcf5b7ff8
129 files changed
+21084
-21652
No files matched your search
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2001-2006 Cisco Systems, Inc.
|
||||
* Copyright (c) 2001-2017 Cisco Systems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -42,35 +42,36 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "alloc.h"
|
||||
#include "crypto_kernel.h"
|
||||
|
||||
/* the debug module for memory allocation */
|
||||
|
||||
debug_module_t mod_alloc = {
|
||||
srtp_debug_module_t mod_alloc = {
|
||||
0, /* debugging is off by default */
|
||||
"alloc" /* printable name for module */
|
||||
};
|
||||
|
||||
/*
|
||||
* Nota bene: the debugging statements for crypto_alloc() and
|
||||
* crypto_free() have identical prefixes, which include the addresses
|
||||
* Nota bene: the debugging statements for srtp_crypto_alloc() and
|
||||
* srtp_crypto_free() have identical prefixes, which include the addresses
|
||||
* of the memory locations on which they are operating. This fact can
|
||||
* be used to locate memory leaks, by turning on memory debugging,
|
||||
* grepping for 'alloc', then matching alloc and free calls by
|
||||
* address.
|
||||
*/
|
||||
|
||||
#ifdef SRTP_KERNEL_LINUX
|
||||
#if defined(HAVE_STDLIB_H)
|
||||
|
||||
#include <linux/interrupt.h>
|
||||
|
||||
void *
|
||||
crypto_alloc(size_t size) {
|
||||
void * srtp_crypto_alloc(size_t size) {
|
||||
void *ptr;
|
||||
|
||||
ptr = kmalloc(size, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
|
||||
|
||||
ptr = malloc(size);
|
||||
|
||||
if (ptr) {
|
||||
debug_print(mod_alloc, "(location: %p) allocated", ptr);
|
||||
} else {
|
||||
@@ -80,33 +81,7 @@ crypto_alloc(size_t size) {
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void
|
||||
crypto_free(void *ptr) {
|
||||
|
||||
debug_print(mod_alloc, "(location: %p) freed", ptr);
|
||||
|
||||
kfree(ptr);
|
||||
}
|
||||
|
||||
|
||||
#elif defined(HAVE_STDLIB_H)
|
||||
|
||||
void *
|
||||
crypto_alloc(size_t size) {
|
||||
void *ptr;
|
||||
|
||||
ptr = malloc(size);
|
||||
|
||||
if (ptr) {
|
||||
debug_print(mod_alloc, "(location: %p) allocated", ptr);
|
||||
} else
|
||||
debug_print(mod_alloc, "allocation failed (asked for %d bytes)\n", size);
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void
|
||||
crypto_free(void *ptr) {
|
||||
void srtp_crypto_free(void *ptr) {
|
||||
|
||||
debug_print(mod_alloc, "(location: %p) freed", ptr);
|
||||
|
||||
|
||||
Reference in new issue
Block a user