On Thu, May 03, 2012 at 03:20:53PM +0200, Michal Toman wrote:
Just a first draft. Not mapping python frames to struct btp_frame,
but using a shortcut and mapping directly to struct backtrace_entry.
Looks good, I have just couple comments.
Note: After reading the code I think there are several memory leaks
(especially struct backtrace_entry is never free'd - or am I missing
It seems it's leaking, but please make a separate patch for it.
+btp_hash_file(char result[BTP_SHA1_RESULT_LEN * 2 + 1], const char *filename)
Would not it be safer to use char * and a length parameter instead of
+ const char *contents = btp_file_to_string(filename);
+ if (!contents)
+ return 0;
+ char result_bytes[BTP_SHA1_RESULT_LEN];
+ btp_sha1_ctx_t sha1ctx;
+ btp_sha1_hash(&sha1ctx, contents, strlen(contents));
+ btp_sha1_end(&sha1ctx, result_bytes);
+ btp_bin2hex(result, result_bytes, BTP_SHA1_RESULT_LEN) = '\0';
free(contents) seems to be missing here.
+ return 1;