mirror of
https://github.com/Motion-Project/motion.git
synced 2025-12-23 23:18:21 -05:00
mymalloc(): don't cast return value; void* is always promoted
This commit is contained in:
2
conf.c
2
conf.c
@@ -2170,7 +2170,7 @@ char *mystrdup(const char *from)
|
||||
} else {
|
||||
stringlength = strlen(from);
|
||||
stringlength = (stringlength < PATH_MAX ? stringlength : PATH_MAX);
|
||||
tmp = (char *)mymalloc(stringlength + 1);
|
||||
tmp = mymalloc(stringlength + 1);
|
||||
strncpy(tmp, from, stringlength);
|
||||
|
||||
/*
|
||||
|
||||
2
event.c
2
event.c
@@ -143,7 +143,7 @@ static void event_sqlnewfile(struct context *cnt, int type ATTRIBUTE_UNUSED,
|
||||
// Close connection before start a new connection
|
||||
mysql_close(cnt->database);
|
||||
|
||||
cnt->database = (MYSQL *) mymalloc(sizeof(MYSQL));
|
||||
cnt->database = mymalloc(sizeof(MYSQL));
|
||||
mysql_init(cnt->database);
|
||||
|
||||
if (!mysql_real_connect(cnt->database, cnt->conf.database_host,
|
||||
|
||||
2
motion.c
2
motion.c
@@ -829,7 +829,7 @@ static int motion_init(struct context *cnt)
|
||||
// close database to be sure that we are not leaking
|
||||
mysql_close(cnt->database);
|
||||
|
||||
cnt->database = (MYSQL *) mymalloc(sizeof(MYSQL));
|
||||
cnt->database = mymalloc(sizeof(MYSQL));
|
||||
mysql_init(cnt->database);
|
||||
|
||||
if (!mysql_real_connect(cnt->database, cnt->conf.database_host, cnt->conf.database_user,
|
||||
|
||||
7
netcam.c
7
netcam.c
@@ -121,7 +121,7 @@ static char *netcam_url_match(regmatch_t m, const char *input)
|
||||
if (m.rm_so != -1) {
|
||||
len = m.rm_eo - m.rm_so;
|
||||
|
||||
if ((match = (char *) mymalloc(len + 1)) != NULL) {
|
||||
if ((match = mymalloc(len + 1)) != NULL) {
|
||||
strncpy(match, input + m.rm_so, len);
|
||||
match[len] = '\0';
|
||||
}
|
||||
@@ -2128,7 +2128,7 @@ static int netcam_http_build_url(netcam_context_ptr netcam, struct url_t *url)
|
||||
int ix;
|
||||
|
||||
/* First the http context structure. */
|
||||
netcam->response = (struct rbuf *) mymalloc(sizeof(struct rbuf));
|
||||
netcam->response = mymalloc(sizeof(struct rbuf));
|
||||
memset(netcam->response, 0, sizeof(struct rbuf));
|
||||
|
||||
MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO, "%s: Netcam has flags:"
|
||||
@@ -2721,8 +2721,7 @@ int netcam_start(struct context *cnt)
|
||||
* Create a new netcam_context for this camera
|
||||
* and clear all the entries.
|
||||
*/
|
||||
cnt->netcam = (struct netcam_context *)
|
||||
mymalloc(sizeof(struct netcam_context));
|
||||
cnt->netcam = mymalloc(sizeof(struct netcam_context));
|
||||
memset(cnt->netcam, 0, sizeof(struct netcam_context));
|
||||
netcam = cnt->netcam; /* Just for clarity in remaining code. */
|
||||
netcam->cnt = cnt; /* Fill in the "parent" info. */
|
||||
|
||||
@@ -70,7 +70,7 @@ int header_get(netcam_context_ptr netcam, char **hdr, enum header_get_flags flag
|
||||
int i;
|
||||
int bufsize = 80;
|
||||
|
||||
*hdr = (char *)mymalloc(bufsize);
|
||||
*hdr = mymalloc(bufsize);
|
||||
|
||||
for (i = 0; 1; i++) {
|
||||
int res;
|
||||
@@ -257,7 +257,7 @@ void base64_encode(const char *s, char *store, int length)
|
||||
*/
|
||||
char *strdupdelim(const char *beg, const char *end)
|
||||
{
|
||||
char *res = (char *)mymalloc(end - beg + 1);
|
||||
char *res = mymalloc(end - beg + 1);
|
||||
memcpy (res, beg, end - beg);
|
||||
|
||||
res[end - beg] = '\0';
|
||||
|
||||
2
stream.c
2
stream.c
@@ -205,7 +205,7 @@ static void* handle_basic_auth(void* param)
|
||||
char *userpass = NULL;
|
||||
size_t auth_size = strlen(p->conf->stream_authentication);
|
||||
|
||||
authentication = (char *) mymalloc(BASE64_LENGTH(auth_size) + 1);
|
||||
authentication = mymalloc(BASE64_LENGTH(auth_size) + 1);
|
||||
userpass = mymalloc(auth_size + 4);
|
||||
/* base64_encode can read 3 bytes after the end of the string, initialize it. */
|
||||
memset(userpass, 0, auth_size + 4);
|
||||
|
||||
@@ -2498,7 +2498,7 @@ void httpd_run(struct context **cnt)
|
||||
char *userpass = NULL;
|
||||
size_t auth_size = strlen(cnt[0]->conf.webcontrol_authentication);
|
||||
|
||||
authentication = (char *) mymalloc(BASE64_LENGTH(auth_size) + 1);
|
||||
authentication = mymalloc(BASE64_LENGTH(auth_size) + 1);
|
||||
userpass = mymalloc(auth_size + 4);
|
||||
/* base64_encode can read 3 bytes after the end of the string, initialize it */
|
||||
memset(userpass, 0, auth_size + 4);
|
||||
|
||||
Reference in New Issue
Block a user