From: Cyril Hrubis <chrubis@suse.cz>
To: Manjeet Pawar <manjeet.p@samsung.com>
Cc: "ajeet.y@samsung.com" <ajeet.y@samsung.com>,
"ltp-list@lists.sourceforge.net" <ltp-list@lists.sourceforge.net>,
Yogesh Narayan Gaur <yn.gaur@samsung.com>
Subject: Re: [LTP] [PATCH]: Add check for realloc failure case
Date: Mon, 1 Jun 2015 16:22:49 +0200 [thread overview]
Message-ID: <20150601142249.GA10758@rei.suse.de> (raw)
In-Reply-To: <947582411.189461432787431522.JavaMail.weblogic@epmlwas05c>
Hi!
> @@ -110,9 +111,13 @@ const char **splitstr(const char *str, const char *separator, int *argcount)
> cur_tok = strtok(NULL, separator);
> if (num_toks == max_toks) {
> max_toks += 20;
> - arg_array =
> - (char **)realloc((void *)arg_array,
> - sizeof(char *) * max_toks);
> + if((arg_array = realloc((void *)arg_array,sizeof(char *) * max_toks)) == NULL){
> + fprintf(stderr, "realloc: New memory allocation failed \n");
> + free(arg_array);
> + free(arg_string);
> + exit(1);
> + }
> +
These lines does not conform to LKML coding style.
There should be space before the opening curly brace '{', spaces after
coma, etc.
You can use checkpatch.pl shipped with linux kernel source to check your
patches before sending them.
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
next prev parent reply other threads:[~2015-06-01 14:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-28 4:30 [LTP] [PATCH]: Add check for realloc failure case Manjeet Pawar
2015-06-01 14:22 ` Cyril Hrubis [this message]
-- strict thread matches above, loose matches on Subject: below --
2015-05-28 4:33 [LTP] [PATCH]: Add check for realloc() " Manjeet Pawar
2015-06-01 14:25 ` Cyril Hrubis
2015-05-28 4:36 Manjeet Pawar
[not found] <149090115.398111433218346536.JavaMail.weblogic@epmlwas08b>
2015-06-04 16:27 ` [LTP] [PATCH]: Add check for realloc " Cyril Hrubis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150601142249.GA10758@rei.suse.de \
--to=chrubis@suse.cz \
--cc=ajeet.y@samsung.com \
--cc=ltp-list@lists.sourceforge.net \
--cc=manjeet.p@samsung.com \
--cc=yn.gaur@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox